SHA2 or SHA256

  • Good Day,

    Whether SQL Server supports SHA2 or SHA256 in any of the available versions?

    If not what is the alternate?

    Thanks,

    RJ

  • SQL Server available encryption functions do not include SHA2 or SHA256

    Available are DES, Triple DES, TRIPLE_DES_3KEY, RC2, RC4, 128-bit RC4, DESX, 128-bit AES, 192-bit AES, and 256-bit AES.

    http://technet.microsoft.com/en-us/library/ms345262.aspx

    SQL = Scarcely Qualifies as a Language

  • From the books online, I was able to find out SHA2 is not supported but is there a custom algorithm that I could use for my application. DES, & RC are deprecated hence will not be available in future versions. I'm not certain our business will approve using AES.

    SHA2 is our goal & we use SQL Server 2005.

  • The only hash functions built into SQL Server 2008 are MD2, MD4, MD5, SHA, or SHA1.

    If you need another hash algorithim, you will need to create your own custom function for that, or create the hash in your front-end application.

    I believe that SHA1 is the strongest hash algorithim built into SQL Servr 2008.

  • Thanks, Michael

    Our application secures all application in our enterprise & the current security protocols demand we move to SHA2 hashing. Since we use SQL Server 2005 (we're already in SHA1) I'm not able to recommend any algorithms at this time. I will look through & if lucky, will find some SHA2 custom algorithm.

    Thanks.

  • You can do it with a CLR assembly. I have just submitted an article on how to do it.

    Here is the C# code for the assembly.

    using System;

    using System.Security.Cryptography;

    using System.Text;

    public class SHA256HashCode

    {

    public static string sha256HashProc(string inputString)

    {

    SHA256Managed crypt = new SHA256Managed();

    string hashString = String.Empty;

    byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(inputString), 0, Encoding.UTF8.GetByteCount(inputString));

    foreach (byte bit in crypto)

    {

    hashString += bit.ToString("x2");

    }

    return hashString;

    }

    }

    Here is an article I wrote about compiling and deploying a CLR assembly.

    http://www.sqlservercentral.com/articles/T-SQL/101154/

    You will need to make it a strongly-named assembly, however, and this article doesn't talk about that. If you are interested I can talk you through it.

    Hopefully my new article will be published soon.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply