HMACBinary
Computes the MD5, RIPEMD160, SHA1, SHA256, SHA384, or SHA512 Hash-based Message Authentication (HMAC) of a binary input in SQL Server
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.HMACBinary ( @Algorithm, @BinaryToHash, @HashKey )
Name | Type | Description |
---|---|---|
@Algorithm | varchar(20) | One of the following Algorithm: MD5, RIPEMD160, SHA1, SHA256, SHA384, or SHA512 |
@BinaryToHash | varbinary(MAX) | Binary data to hash |
@HashKey | varchar(MAX) | The key to use in the hash algorithm |
varbinary(MAX)
We provide two distinct functions: HMACBinary and HMACString
1 2 3 4 5 6 7 8 9 10 11 12 13 |
DECLARE @Algorithm varchar(20) DECLARE @BinaryToHash varbinary(MAX) DECLARE @HashKey varchar(MAX) SET @Algorithm = 'SHA1' SET @BinaryToHash = 0x540068006500200071007500690063006B002000620072006F0077006E00200066006F00780020006A0075006D007000730020006F00760065007200200074006800650020006C0061007A007900200064006F006700 SET @HashKey = 'Secret Key or passphrase' SELECT SQLHTTP.net.HMACBinary(@Algorithm, @BinaryToHash, @HashKey) |
1 2 3 4 |
-------------------------------------------------- 0x988524FB3016D3992EACB7EC7913888DB2DB3DC3 |