Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pbkdf2 v0.7.3 #131

Merged
merged 1 commit into from Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 20 additions & 19 deletions .github/workflows/pbkdf2.yml
Expand Up @@ -17,25 +17,26 @@ env:
RUSTFLAGS: "-Dwarnings"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.47.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo build --target ${{ matrix.target }} --release --no-default-features
# TODO(tarcieri): test when new cargo resolver is available (RFC 2957)
# build:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# rust:
# - 1.47.0 # MSRV
# - stable
# target:
# - thumbv7em-none-eabi
# - wasm32-unknown-unknown
# steps:
# - uses: actions/checkout@v1
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true
# - run: cargo build --target ${{ matrix.target }} --release --no-default-features

test:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pbkdf2/CHANGELOG.md
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.7.3 (2021-02-08)
### Changed
- Enable `rand_core` feature of `password-hash` ([#130])

[#130]: https://github.com/RustCrypto/password-hashing/pull/130

## 0.7.2 (2021-02-01)
### Changed
- Bump `base64ct` dependency to v0.2 ([#119])
Expand Down
3 changes: 2 additions & 1 deletion pbkdf2/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pbkdf2"
version = "0.7.2"
version = "0.7.3"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
description = "Generic implementation of PBKDF2"
Expand All @@ -24,6 +24,7 @@ sha2 = { version = "0.9", default-features = false, optional = true }
[dev-dependencies]
hex-literal = "0.3"
hmac = "0.10"
rand_core = { version = "0.6", features = ["std"] }
sha1 = { version = "0.9", package = "sha-1" }
sha2 = "0.9"

Expand Down
39 changes: 38 additions & 1 deletion pbkdf2/src/lib.rs
Expand Up @@ -7,7 +7,44 @@
//!
//! ```toml
//! [dependencies]
//! pbkdf2 = { version = "0.2", default-features = false }
//! pbkdf2 = { version = "0.7", default-features = false }
//! ```
//!
//! # Usage (simple with default params)
//!
//! Note: this example requires the `rand_core` crate with the `std` feature
//! enabled for `rand_core::OsRng` (embedded platforms can substitute their
//! own RNG)
//!
//! Add the following to your crate's `Cargo.toml` to import it:
//!
//! ```toml
//! [dependencies]
//! pbkdf2 = "0.7"
//! rand_core = { version = "0.6", features = ["std"] }
//! ```
//!
//! The following example demonstrates the high-level password hashing API:
//!
//! ```
//! # #[cfg(feature = "password-hash")]
//! # {
//! use pbkdf2::{
//! password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
//! Pbkdf2
//! };
//! use rand_core::OsRng;
//!
//! let password = b"hunter42"; // Bad password; don't actually use!
//! let salt = SaltString::generate(&mut OsRng);
//!
//! // Hash password to PHC string ($pbkdf2-sha256$...)
//! let password_hash = Pbkdf2.hash_password_simple(password, salt.as_ref()).unwrap().to_string();
//!
//! // Verify password against PHC string
//! let parsed_hash = PasswordHash::new(&password_hash).unwrap();
//! assert!(Pbkdf2.verify_password(password, &parsed_hash).is_ok());
//! # }
//! ```

#![no_std]
Expand Down