sha512

Generating crypt() sha512 hashes in Go

旧巷老猫 提交于 2019-12-04 21:21:42
I am working on my authorization module in GoLang. Before we used PHP5 with the crypt function. The hash was generated like SHA-512: $6$rounds=5000$usesomesillystri$D4IrlXatmP7rx3P3InaxBeoomnAihCKRVQP22JZ6EY47Wc6BkroIuUUBOov1i.S5KPgErtP/EN5mcO.ChWQW21 And stored like that in the database. But now I need make it work also in GoLang. I have searched on Google and tried different things, such as: t512 := sha512_crypt.Crypt("rasmuslerdorf", "$6$usesomesillystringforsalt$") fmt.Printf("hash: %v\n", t512) But all generate different things. Who can help us further? We want validate and create hashes

HMAC SHA512 using CommonCrypto in Swift 3.1 [duplicate]

纵饮孤独 提交于 2019-12-04 20:41:42
This question already has an answer here: CommonHMAC in Swift 10 answers I'm trying to encrypt data to send to the API. The API requires the data to be sent as hmac_sha512 encrypted hash. I've found various examples of how it possibly could have been done for sha1 and others (not sha512 ) and also in older versions of Swift. None of the examples that I tried work for swift 3.1 Any help in the right direction will be appreciated. Edit: In PHP, I successfully send it using: $sign = hash_hmac('sha512', $post_data, $this->secret); Edit 2: I did add briding header , I don't know what to do next! As

How to decrypt a “sha512” encrypted variable?

流过昼夜 提交于 2019-12-04 07:09:50
问题 I have this code: $password = vancab123; password_hash(base64_encode( hash('sha512',$password, true) ), PASSWORD_DEFAULT ); Database stored value: $password = $2y$10$jUa8ZEFBX5lfsBmySUnJFeSSyKwQ1v/emazJZPh8MwJ0g0lLbmjYC; My Problem: I used that on "remember me" function. If the user used that function his/her credentials (email and password) will be saved for 7 days using cookie. My problem is because the email and password will automatically fill up the email and password text boxes, the

Objective C SHA512 hash of two NSData

一世执手 提交于 2019-12-03 21:28:27
Here is a Java code, which computes SHA512 hash of a byte array with salt: private static String DIGEST_ALGORITHM = "SHA-512"; public static byte[] getHash(final byte[] data, final byte[] salt) throws NoSuchAlgorithmException { final MessageDigest md = MessageDigest.getInstance(DIGEST_ALGORITHM); md.reset(); if (salt != null) { md.update(salt); } return md.digest(data); In Objective C, I use this algorithm for compute the hash of an NSData: @implementation NSData (CommonDigest) - (NSData *) SHA512Hash { unsigned char hash[CC_SHA512_DIGEST_LENGTH]; (void) CC_SHA512( [self bytes], (CC_LONG)[self

How to hash a string to SHA512 in Swift?

北战南征 提交于 2019-12-03 13:39:46
I am building a social media application and I would like some help encoding a password string to SHA512 in Swift. I found the CryptoSwift library on GitHub but I am having a hard time loading it into my Swift project and linking it to my project files. Does anyone know how to accomplish this relatively easily? Thanks in advance, Kyle Solution for Swift 3 : extension String { func sha512() -> String { let data = self.data(using: .utf8)! var digest = [UInt8](repeating: 0, count: Int(CC_SHA512_DIGEST_LENGTH)) data.withUnsafeBytes({ _ = CC_SHA512($0, CC_LONG(data.count), &digest) }) return digest

Hash string with SHA512 in Swift

大兔子大兔子 提交于 2019-12-03 12:59:31
问题 Anyone knows how to reproduce PHP hashing method hash(‘SHA512’, $value, true) in swift ? I tried to use CommonCrypto C library with this code : extension String { func digest(length:Int32, gen:(data: UnsafePointer<Void>, len: CC_LONG, md: UnsafeMutablePointer<UInt8>) -> UnsafeMutablePointer<UInt8>) -> String { var cStr = [UInt8](self.utf8) var result = [UInt8](count:Int(length), repeatedValue:0) gen(data: &cStr, len: CC_LONG(cStr.count), md: &result) let output = NSMutableString(capacity:Int

How to calculate a SHA-512 hash in C++ on Linux?

≯℡__Kan透↙ 提交于 2019-12-03 11:37:07
Is there a standard library or commonly used library that can be used for calculating SHA-512 hashes on Linux? I'm looking for a C or C++ library. Zimbabao Have you checked OpenSSL . I myself have not used it but documentation says it supports it. Here is list of few more implementations. Example code md = EVP_get_digestbyname("sha512"); EVP_MD_CTX_init(&mdctx); EVP_DigestInit_ex(&mdctx, md, NULL); EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); EVP_DigestFinal_ex(&mdctx, md_value, &md_len); EVP_MD_CTX_cleanup(&mdctx); Check this code . It is

sha512-crypt mysql and dovecot

旧街凉风 提交于 2019-12-03 06:21:26
I have a question about understanding sha512-crypt hashing. I found this tutorial to set up dovecot and postfix with mysql. I followed the tutorial (with slight modifications) and everything works fine. But there is one thing, that I do not understand: To add a user, I should use: INSERT INTO `mailserver`.`virtual_users` (`id`, `domain_id`, `password` , `email`) VALUES ('1', '1', ENCRYPT('firstpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'email1@example.com'), ('2', '1', ENCRYPT('secondpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'email2@example.com'); and again, this

Hash string with SHA512 in Swift

倾然丶 夕夏残阳落幕 提交于 2019-12-03 03:13:44
Anyone knows how to reproduce PHP hashing method hash(‘SHA512’, $value, true) in swift ? I tried to use CommonCrypto C library with this code : extension String { func digest(length:Int32, gen:(data: UnsafePointer<Void>, len: CC_LONG, md: UnsafeMutablePointer<UInt8>) -> UnsafeMutablePointer<UInt8>) -> String { var cStr = [UInt8](self.utf8) var result = [UInt8](count:Int(length), repeatedValue:0) gen(data: &cStr, len: CC_LONG(cStr.count), md: &result) let output = NSMutableString(capacity:Int(length)) for r in result { output.appendFormat("%02x", r) } return String(output) } } and used it like

how to implement sha 512,md5 and salt encryption all for one password [duplicate]

走远了吗. 提交于 2019-12-02 21:11:02
This question already has an answer here: Secure hash and salt for PHP passwords 14 answers $pass="test" the above variable contains a password called test.I want to hash this password using sha512 md5 and salt how do i do that as ive found only benifits of salt and sha512,i allready know md5 encryption.please i need the solution as my system is vunerable and please explain it with a code example because im still attached to md5 from what ive understood by your comments and answers ive got the following code $pass="test"; $hashed_pass= openssl_digest($pass, 'sha512'); ok seems solid enough but