Please help me the code (Java) to encrypt and decrypt ( will be better if using private key) with SHA256.
encrypt- decrypt with SHA256 using java
20.7k views Asked by MartinJoo At
4
There are 4 answers
0

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.
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.