Hashing more than 8000 bytes in SQL Server

后端 未结 3 822
感情败类
感情败类 2020-12-16 05:36

SQL Server\'s hashing function HASHBYTES has an input limit of 8000 bytes.

How do you hash larger strings?

3条回答
  •  温柔的废话
    2020-12-16 06:20

    You could hash 8k (or 4k or 2k) chunks of the input and then either concatenate those hashes or hash them into a new hash value. This might get difficult though if you have to create a similar algorithm (in an external .NET app for example) to compare hashes created outside of SQL Server.

    Another option: Lean on SQL Server's CLR integration and perform the hashing in a .NET assembly.

提交回复
热议问题