1
2
//前面有3节模块1,模块2,模块3的内容没有保存...

模块4

1
2
3
4
5
6
7
8
9
//cargo.toml
[package]
name = "learn"
version = "0.1.0"
authors = ["andy"]
edition = "2018"

[dependencies]
rust-crypto = "0.2" //使用外部库
  • 使用这个库
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    extern crate crypto;

    use crypto::digest::Digest;
    use crypto::sha3::Sha3;

    fn main() {
    let mut hasher = Sha3::sha3_256();
    hasher.input_str("hello world");
    let result = hasher.result_str();
    println!("hash == {}",result);


    }