• Paul White (8/10/2009)


    RBarryYoung (8/10/2009)


    To clarify: HashBytes w/ SHA1 is nigh-unbreakable.

    Hey Barry,

    On the other hand, it is relatively slow, only works on strings, and returns varbinary(8000).

    If the task is to detect changes in a row of data, would you use HashBytes (SHA1) alone?

    Paul

    Despite the datatype, I think that it actually only returns 19 bytes. And since VARBINARY is a string and *everything* converts to varbinary very easily, thats not that big a problem (nulls are a bigger problem). So yeah, I *might* use it in situations were I was doing remote comparisons through linked servers and just recording the hash every day for later comparison. The problem with the field by field comparison is that you have to have the entire previous record around to do it.

    Though I think that I usually used MD5 in the past.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]