My scenarion is i am encdoing the value generated from Crypto.generateDigest method and encdoing it with EncodingUtil.base64Encode .Now i am not able to decrypt it again .Can u any one help on this below is the code block how i encrypt the data. i want to decrypt back SecretAnswer1.

Blob blobKey         =  crypto.generateAesKey(128);
string secretanswer  =  EncodingUtil.convertToHex(blobKey).substring(0,6);
Blob b               =  Crypto.GenerateAESKey(128);
String h             =  EncodingUtil.ConvertTohex(b);
String guid          =  h.SubString(0,8)+ '-' + h.SubString(8,12) + '-' + h.SubString(12,16) + '-' + h.SubString(16,20) + '-' + h.substring(20);
Blob hash            =  Crypto.generateDigest('SHA-512', Blob.valueOf(secretanswer + guid));
string SecretAnswer1 =  EncodingUtil.base64Encode(hash);

1 Answer 1


Crypto.generateDigest creates a one-way hash, or fingerprint, of a given payload. It is not reversible, because it does not contain the original data. Instead, use Crypto.encrypt or Crypto.encryptWithManagedIv if you expect to be able to get the data back out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .