Struct SHA1
pub struct SHA1 { /* private fields */ }Available on crate features
hash and insecure_sha1 only.Expand description
安全散列算法1流式计算器(Secure Hash Algorithm 1 Stream Mode Calculator)
安全散列算法1是一种密码杂凑算法,美国国家安全局设计,并由美国国家标准技术研究所发布为联邦资料处理标准。
In cryptography, SHA-1 (Secure Hash Algorithm 1) is a hash function
which was designed by the United States National Security Agency, and is a U.S. Federal Information Processing Standard.
SHA-1可以生成一个被称为消息摘要的160位(20字节)杂凑值,杂凑值通常的呈现形式为40个十六进制数。
It takes an input and produces a 160-bit (20-byte) hash value known as a message digest -
typically rendered as 40 hexadecimal digits.
§示例(Examples)
use neuedu_cryptos::hashs::{HashImpl, SHA1};
const MESSAGE: [u8; 3] = [
0x61, 0x62, 0x63,
];
let mut instance = SHA1::default();
instance.update(&MESSAGE)?;
let digest = instance.r#final()?;
assert_eq!(digest, [
0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A,
0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C,
0x9C, 0xD0, 0xD8, 0x9D,
]);