HashString
Computes the MD5, RIPEMD160, SHA1, SHA256, SHA384, or SHA512 hash of a string input in SQL Server without an 8000 bytes limitation
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.HashString ( @Algorithm, @StringToHash )
Name | Type | Description |
---|---|---|
@Algorithm | varchar(20) | One of the following Algorithm: MD5, RIPEMD160, SHA1, SHA256, SHA384, or SHA512 |
@StringToHash | varchar(MAX) | String data to hash |
varbinary(MAX)
This function is similar to the Microsoft’s HashBytes SQL Server function, but with slightly different algorithms and without the 8000 bytes limitation. We provide three distinct functions: HashBinary, HashString, and HashUnicode
1 2 3 4 5 6 7 8 9 10 |
DECLARE @Algorithm varchar(20) DECLARE @StringToHash varchar(MAX) SET @Algorithm = 'MD5' SET @StringToHash = 'The quick brown fox jumps over the lazy dog' SELECT SQLHTTP.net.HashString(@Algorithm, @StringToHash) |
1 2 3 4 |
-------------------------------------------------- 0x9E107D9D372BB6826BD81D3542A419D6 |