SQL Server中的sha256函数[duplicate]

时间:2022-08-15 16:46:21

This question already has an answer here:

这个问题已经有了答案:

Is there a built-in sha256 function in SQL Server? I can't find a sha256 T-SQL function source code either. Anyone who has an alternative?

在SQL Server中是否有一个内置的sha256函数?我也找不到sha256 T-SQL函数的源代码。有其他选择吗?

2 个解决方案

#1


24  

SQL Server 2012 supports SHA2_256 and SHA2_512.

SQL Server 2012支持SHA2_256和SHA2_512。

 SELECT HASHBYTES('SHA2_256','something')

#2


3  

I think you are looking for HASHBYTES, but it supports only up to SHA-1 (160 bytes)

我认为您正在寻找HASHBYTES,但是它只支持SHA-1(160字节)

FYI Hashing is not encrypting. It is irreversible. Encryption is a process that is reversible to get the original data.

FYI哈希不加密。它是不可逆转的。加密是一个获取原始数据的可逆过程。

Reference for SHA2

用户参考SHA2

SHA-2 is a set of cryptographic hash functions (SHA-224, SHA-256, SHA-384, SHA-512)

SHA-2是一组密码散列函数(SHA-224、SHA-256、SHA-384、SHA-512)


Here is a discussion about adding a salt to hashes

As for 256-byte hashing function - there isn't one built in.

至于256字节的哈希函数——没有内置的。

#1


24  

SQL Server 2012 supports SHA2_256 and SHA2_512.

SQL Server 2012支持SHA2_256和SHA2_512。

 SELECT HASHBYTES('SHA2_256','something')

#2


3  

I think you are looking for HASHBYTES, but it supports only up to SHA-1 (160 bytes)

我认为您正在寻找HASHBYTES,但是它只支持SHA-1(160字节)

FYI Hashing is not encrypting. It is irreversible. Encryption is a process that is reversible to get the original data.

FYI哈希不加密。它是不可逆转的。加密是一个获取原始数据的可逆过程。

Reference for SHA2

用户参考SHA2

SHA-2 is a set of cryptographic hash functions (SHA-224, SHA-256, SHA-384, SHA-512)

SHA-2是一组密码散列函数(SHA-224、SHA-256、SHA-384、SHA-512)


Here is a discussion about adding a salt to hashes

As for 256-byte hashing function - there isn't one built in.

至于256字节的哈希函数——没有内置的。