Archive for Gennaio 1st, 2008

Create Managed SHA512 Hash

CodeKeep C# Feed Gennaio 1st, 2008

Description: Creates a Managed SHA512 Hash Value

Link: http://www.codekeep.net/snippets/fc32a2b8-9a0d-4595-a656-1a3e380efaac.aspx

        /// <summary>
        /// Creates a SHA512 Hash Value of a given string.
        /// </summary>
        /// <param name="plainText">the string value to perform the hash against</param>
        /// <returns>the hash string value</returns>
        public static string GetHash(string plainText)
        {
            SHA512Managed hasher = new SHA512Managed();
            return BitConverter.ToString(hasher.ComputeHash(Encoding.ASCII.GetBytes(plainText)));
        }