Reputation: 2682
In my Windows Phone application I need to get hash using SHA-1 Algorithm. How can I do this? For example I have string text="1234";
Upvotes: 2
Views: 2093
Reputation: 141678
You would use the SHA1Managed
class to compute the hash of a byte array. Probably do something like this:
var sha = new SHA1Managed();
var bytes = System.Text.Encoding.UTF8.GetBytes(text);
byte[] resultHash = sha.ComputeHash(bytes);
Upvotes: 5
Reputation: 1806
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(text));
Upvotes: 0