SHA2
描述
使用SHA2对信息进行摘要处理。
语法
SHA2( <str>, <digest_length>)
参数
参数 | 说明 |
---|---|
<str> | 待加密的内容 |
<digest_length> | 摘要长度,支持 224, 256, 384, 512 |
返回值
返回输入字符串的sha2值
示例
select sha2('abc', 224), sha2('abc', 384), sha2(NULL, 512);
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
| sha2('abc', 224) | sha2('abc', 384) | sha2(NULL, 512) |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+
| 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 | cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 | NULL |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------+