encrypt / decrypt string with SHA512

  • Thread starter Thread starter Frank Uray
  • Start date Start date
F

Frank Uray

Hi all

I am trying to build two functions (EncryptString and DecryptString).
I would like to use the highest possible security (SHA512Managed ?).

I have found the following code:
System.Security.Cryptography.SHA512Managed HashTool = new
System.Security.Cryptography.SHA512Managed();
Byte[] PasswordAsByte =
System.Text.Encoding.UTF8.GetBytes(string.Concat(Password, Salt));
Byte[] EncryptedBytes = HashTool.ComputeHash(PasswordAsByte);
HashTool.Clear();
return Convert.ToBase64String(EncryptedBytes);

How can I decrypt a string encypted with the above code ??
Or are the better methods ?

Thanks for your help.
Best regards
Frank Uray
 
How can I decrypt a string encypted with the above code ??

SHA is a hash, so you can't reverse it.
Or are the better methods ?

If you want a symmetric algorithm (same key to encrypt/decrypt), I would
consider AES (Rijndael). Note that the framework has both AesManaged and
RijndaelManaged, but they are pretty much the same as far as safety. The
NSA has approved AES, so it is the current banking standard.

Triple DES would be the next one on my list (older banking standard) if
I could not use AES. DES and RC2 are dated and should not be considered,
as each can easily be cracked these days.

Peace and Grace,


--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top