我正在测试sha2库(https://docs.rs/sha2/0.9.3/sha2/)。
let base2: i32 = 2;
let total_size = base2.pow(24);
let mut data = vec![0u8;total_size as usize];
let mut hasher = Sha256::new();
hasher.update(data);
let result = hasher.finalize();
println!("sha256 before write: {}", result);
但是我无法打印出结果:
error[E0277]: `GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>` doesn't implement `std::fmt::Display`
--> src/sha_check.rs:60:41
|
60 | println!("sha256 before write: {}", result);
| ^^^^^^ `GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>` cannot be formatted with the default formatter
如何转储 GenericArray
?
我尝试查找 .finalize()
,但不知道它来自哪里。