Rust Argon2 项目使用教程

Rust Argon2 项目使用教程

rust-argon2Rust library for hashing passwords using Argon2.项目地址:https://gitcode.com/gh_mirrors/ru/rust-argon2

1. 项目的目录结构及介绍

Rust Argon2 项目的目录结构如下:

rust-argon2/
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── src/
│   ├── lib.rs
│   ├── argon2.rs
│   ├── params.rs
│   ├── errors.rs
│   ├── core.rs
│   ├── thread.rs
│   ├── blake2b.rs
│   └── test.rs
└── tests/
    └── integration_tests.rs

目录结构介绍

  • Cargo.toml: 项目的依赖和元数据配置文件。
  • LICENSE-APACHELICENSE-MIT: 项目的开源许可证文件。
  • README.md: 项目说明文档。
  • src/: 包含项目的源代码文件。
    • lib.rs: 库的入口文件。
    • argon2.rs: Argon2 实现的主要逻辑。
    • params.rs: Argon2 参数配置。
    • errors.rs: 错误处理模块。
    • core.rs: 核心功能实现。
    • thread.rs: 多线程支持。
    • blake2b.rs: Blake2b 哈希函数实现。
    • test.rs: 单元测试模块。
  • tests/: 集成测试目录。
    • integration_tests.rs: 集成测试文件。

2. 项目的启动文件介绍

项目的启动文件是 src/lib.rs,它是 Rust Argon2 库的入口文件。该文件主要负责导出库的公共接口和模块。

pub mod argon2;
pub mod params;
pub mod errors;
pub mod core;
pub mod thread;
pub mod blake2b;

pub use argon2::Argon2;
pub use params::Params;
pub use errors::Error;

启动文件介绍

  • pub mod argon2;: 导出 Argon2 模块。
  • pub mod params;: 导出参数配置模块。
  • pub mod errors;: 导出错误处理模块。
  • pub mod core;: 导出核心功能模块。
  • pub mod thread;: 导出多线程支持模块。
  • pub mod blake2b;: 导出 Blake2b 哈希函数模块。
  • pub use argon2::Argon2;: 导出 Argon2 结构体。
  • pub use params::Params;: 导出参数配置结构体。
  • pub use errors::Error;: 导出错误类型。

3. 项目的配置文件介绍

项目的配置文件是 Cargo.toml,它包含了项目的依赖、元数据和其他配置信息。

[package]
name = "rust-argon2"
version = "0.8.3"
authors = ["Martijn Rijkeboer <mrr@sru-systems.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
description = "Rust implementation of the Argon2 password hashing function"
repository = "https://github.com/sru-systems/rust-argon2"
readme = "README.md"
keywords = ["argon2", "password", "hashing", "crypto"]
categories = ["cryptography"]

[dependencies]
base64ct = "1.0"
blake2 = "0.9"
password-hash = "0.3"
zeroize = "1.0"
hex-literal = "0.3"
cpufeatures = "0.2"

[dev-dependencies]
password-hash = "0.3"

[features]
default = ["std"]
std = []

配置文件介绍

  • [package]: 项目的基本信息。
    • name: 项目名称。
    • version: 项目版本。
    • authors: 项目作者。
    • edition: Rust 版本。
    • license: 项目许可证。
    • description: 项目描述。
    • repository: 项目仓库地址。
    • readme: 项目

rust-argon2Rust library for hashing passwords using Argon2.项目地址:https://gitcode.com/gh_mirrors/ru/rust-argon2

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

劳允椒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值