iPhone/OS X LION: How to retrieve the decoded data from the CC_SHA256 encrypted data?

前端 未结 2 1789
失恋的感觉
失恋的感觉 2021-01-29 10:11

I am encoding NSString input using the following code (CC_SHA256). Could someone help me retrieving in decoded format using the same logic?

    -(NSString*) enco         


        
相关标签:
2条回答
  • 2021-01-29 10:36

    As the others have noted, SHA-1 and the SHA-2 variants are by design one-way hashes. If you can reverse them, the hashes are broken. The hashes are designed to check data integrity, not to provide data encryption.

    If you want encryption/decryption as opposed to hashing, you want to use one of CommonCrypto's CCCryptor routines. See:

    Any cocoa source code for AES encryption decryption?

    0 讨论(0)
  • 2021-01-29 11:02

    You can't SHA is a hashing algoritm, not ment to be decoded.

    Like Jonathan Grynspan said, if you could decode sha (any version) would defeat the purpose of such an algorithm.

    0 讨论(0)
提交回复
热议问题