• Igor Micev (1/5/2016)


    J Livingston SQL (1/4/2016)


    Wayne West (1/4/2016)


    Steve, I'd like to see your code because I can't duplicate it. I ran the following:

    DECLARE @HashThis VARCHAR(20) = 'January 1, 2016';

    SELECT 'MD2' AS HashType, hashbytes('MD2',@HashThis) AS HashVal

    UNION

    SELECT 'MD4', hashbytes('MD4',@HashThis)

    UNION

    SELECT 'MD5', hashbytes('MD5',@HashThis)

    UNION

    SELECT 'SHA', hashbytes('SHA',@HashThis)

    UNION

    SELECT 'SHA1', hashbytes('SHA1',@HashThis)

    UNION

    SELECT 'SHA2-256', hashbytes('SHA2-256',@HashThis)

    UNION

    SELECT 'SHA2-512', hashbytes('SHA2-512',@HashThis);

    And got this as text output:

    HashType HashVal

    -------- ------------------------------------------------------------------------ ...

    MD2 0x597769E83A509A788FC891AD451B102B

    MD4 0x760C51EFC11D5B932BDCA99ED0B889CD

    MD5 0xF1A4456FAF93F6FD842344D0AC06D7A1

    SHA 0xD186F5A70C77B99E0FB644C86066E267218A1BC8

    SHA1 0xD186F5A70C77B99E0FB644C86066E267218A1BC8

    SHA2-256 NULL

    SHA2-512 NULL

    (7 row(s) affected)

    I find it odd that I'm getting nulls for the SHA2 hashbytes. This is on SQL Server 2014 Developer Edition with SP1 (12.0.4100.1). Makes me wonder if something is funky about my installation and I just haven't noticed it yet.

    DECLARE @HashThis VARCHAR(20) = 'January 1, 2016';

    SELECT 'MD2' AS HashType, hashbytes('MD2',@HashThis) AS HashVal

    UNION

    SELECT 'MD4', hashbytes('MD4',@HashThis)

    UNION

    SELECT 'MD5', hashbytes('MD5',@HashThis)

    UNION

    SELECT 'SHA', hashbytes('SHA',@HashThis)

    UNION

    SELECT 'SHA1', hashbytes('SHA1',@HashThis)

    UNION

    SELECT 'SHA2_256 NOTE UNDERSCORE', hashbytes('SHA2_256',@HashThis)

    UNION

    SELECT 'SHA2_512 NOTE UNDERSCORE', hashbytes('SHA2_512',@HashThis);

    Thanks for this.

    Happy New Year!

    Hi Igor , with your code ,I have obtained on my SQL Server Express with Advanced Services 2014 RTM En-US for the 2 last values:

    0x3B26AECCDA7B29EEE926C93A32EB0EEBA212896EF85F63EBE2206C04175C956F

    0x717F004400D0AF13E5ABCEAB7508D5A3FE346671FFA114696B42E22A9158EE1B41BD016F21155437E29E708186DECB603B03A9C509146CECD1B84D4F2647E484

    Have you installed the SP1 ? What is your OS ( mine is a french Windows 10 Home coming from a Windows 8.1 Home ) ?