Hash
Hash - Băm

Syntax - Cú pháp

HASHBYTES( '<algorithm>', { @input, 'input' })
Hash - Băm

Arguments - Đối số

<Algorithm>
MD2MD4MD5SHASHA1SHA2_256SHA2_512
@input

Specifies a variable containing the data to be hashed. @input is varchar, nvarchar, or variable

'input'

Specifies an expression that evaluates to a character or binary string to be hashed.

Hash - Băm

Return Value - Giá trị trả về

Varbinary
MD2MD4MD5SHASHA1SHA2_256SHA2_512
16 bytes16 bytes16 bytes20 bytes20 bytes32 bytes64 bytes
Hash - Băm

Example - Ví dụ

DECLARE @text VARCHAR(8) = '123';
SELECT HASHBYTES('SHA', @text)
or
SELECT HASHBYTES('SHA', '123')