在 SQL Server 中散列超过 8000 个字节 [英] Hashing more than 8000 bytes in SQL Server

查看:23
本文介绍了在 SQL Server 中散列超过 8000 个字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server 的散列函数 HASHBYTES 的输入限制为 8000 字节.

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

如何散列较大的字符串?

How do you hash larger strings?

推荐答案

您可以散列 8k(或 4k 或 2k)块输入,然后连接这些散列或将它们散列成一个新的散列值.但是,如果您必须创建类似的算法(例如在外部 .NET 应用程序中)来比较在 SQL Server 外部创建的哈希值,这可能会变得困难.

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.

另一种选择:依靠 SQL Server 的 CLR 集成 并在.NET 程序集.

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

这篇关于在 SQL Server 中散列超过 8000 个字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆