1

I've encrypted a string(hello) using SHA1 using below code. Please guide me to decrypt this string.

SHA1Managed sha1 = new SHA1Managed();
byte[] hash = sha1.ComputeHash(Encoding.UTF8.GetBytes("hello"));
StringBuilder sb = new StringBuilder(hash.Length * 2);
foreach( byte b in hash)
{
    sb.Append(b.ToString("x2"));
}
string result = sb.ToString();

While searching in internet, I didn't find decryption using SHA1, even in MSDN. Kindly guide me.

geetha
  • 19
  • 1
  • 2
  • Consider doing a little research on what SHA1 and in general what hash functions **are** and waht they are used for. – zaph Feb 22 '16 at 14:02

3 Answers3

8

SHA is a hashing method. It is not an encryption. Therefore, it can not be reversed.

Fundamental difference between Hashing and Encryption algorithms

Community
  • 1
  • 1
Dave Bush
  • 2,382
  • 15
  • 12
5

SHA-1 is an digest algorithm, not an encryption algorithm. You can not reverse a digest algorithm like SHA-1.

The only way would be to brute force all potential inputs and see if you get the same result.

Robert
  • 39,162
  • 17
  • 99
  • 152
3

SHA-1 is a hashing algorithm, not an encryption one. It's impossible to 'decrypt'. Read about SHA-1 on wikipedia and keep in mind it is not safe security wise.

Ivan Leonenko
  • 2,363
  • 2
  • 27
  • 37