C# HMAC Implementation Problem
        Posted  
        
            by Emanuel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Emanuel
        
        
        
        Published on 2010-03-26T21:42:25Z
        Indexed on 
            2010/03/26
            21:43 UTC
        
        
        Read the original article
        Hit count: 698
        
I want my application to encrypt a user password, and at one time password will be decrypted to be sent to the server for authentication. A friend advise me to use HMAC. I wrote the following code in C#:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] key = encoding.GetBytes("secret");
HMACSHA256 myhmacsha256 = new HMACSHA256(key);
byte[] hashValue = myhmacsha256.ComputeHash(encoding.GetBytes("text"));
string resultSTR = Convert.ToBase64String(hashValue);
myhmacsha256.Clear();
How to decode the password (resultSTR, in this case)?
Thanks.
© Stack Overflow or respective owner