• Koen Verbeeck (2/9/2012)


    but the MSDN link doesn't really back-up the explanation as it doesn't mention salt anywhere.

    I'd second this; it's my understanding that concatenating a fixed string as salt (in Steve's example assigned to a variable) to another string can't be considered a salt parameter, which should be a random value (for increased security). The following query will return the exact same results as Steve's proposed solution in the 'Correct Answer' section of this QotD :cool::

    declare @t nvarchar(200)

    select @t = N'This is my string'

    select

    Hashbytes('SHA1', @t)

    , Hashbytes('SHA1', @T + N'R@nd0mS!a6lTValue')

    I'd say, no matter how many string parts are concatenated, the combined string qualifies as { @input | 'input' } following the HASHBYTES syntax.

    Interesting question, though.

    Thanks,

    Michael