Hi guys.
Please help me the code (Java) to encrypt and decrypt ( will be better if using private key) with SHA256. ^^
Thank you so much!
Hi guys.
Please help me the code (Java) to encrypt and decrypt ( will be better if using private key) with SHA256. ^^
Thank you so much!
The Secure Hash Algorithm family of functions are one-way functions. You can use the functions to get a cryptographic hash from any given input, but it is impossible to reverse the function and arrive at the input from any given output hash.
I think you're confused about what SHA is. SHA is a Cryptographic Hash Function, not an encryption algorithm. You can't reverse the operation to determine the message that was used to generate a particular hash.
There have actually been several techniques proposed for turning hash functions into block ciphers that can encrypt and decrypt - for example Peter Gutmann's "Message Digest Cipher".
This paper has some cryptanalysis of some of these techniques.
But you really don't want to do this - you are far better off using a well-studied block cipher, like AES.