From ca7fde1764fc82fc7e51d39b2759ce8698fa0cd0 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Thu, 6 Apr 2023 14:58:44 +0100 Subject: [PATCH] feat(hash): add blake3 body hasher --- actix-hash/CHANGELOG.md | 9 ++++++--- actix-hash/Cargo.toml | 17 ++++++++++------- actix-hash/src/lib.rs | 6 +++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/actix-hash/CHANGELOG.md b/actix-hash/CHANGELOG.md index 4d546cb0..630bb3b3 100644 --- a/actix-hash/CHANGELOG.md +++ b/actix-hash/CHANGELOG.md @@ -2,20 +2,23 @@ ## Unreleased - 2022-xx-xx +- Add `BodyBlake3` extractor. +- Minimum supported Rust version (MSRV) is now 1.64. ## 0.4.0 - 2022-07-02 -- Minimum supported Rust version (MSRV) is now 1.60. +- Minimum supported Rust version (MSRV) is now 1.60. ## 0.3.0 - 2022-03-28 + - Removed `BodyHashParts::body_bytes` field. - Rename `BodyHashParts::{body => inner}` field. - Improve fault tolerance when placed on non-body extractors. - ## 0.2.0 - 2022-03-24 -- Body hashing extractors for many popular, general purpose hashing algorithms. +- Body hashing extractors for many popular, general purpose hashing algorithms. # 0.1.0 + - Empty crate. diff --git a/actix-hash/Cargo.toml b/actix-hash/Cargo.toml index fdb4f3b7..2eab7670 100644 --- a/actix-hash/Cargo.toml +++ b/actix-hash/Cargo.toml @@ -20,15 +20,17 @@ rustdoc-args = ["--cfg", "docsrs"] [features] default = [ "blake2", - "md5", + "blake3", "md4", + "md5", "sha1", "sha2", "sha3", ] blake2 = ["dep:blake2"] -md5 = ["dep:md5"] +blake3 = ["dep:blake3"] md4 = ["dep:md4"] +md5 = ["dep:md5"] sha1 = ["dep:sha1"] sha2 = ["dep:sha2"] sha3 = ["dep:sha3"] @@ -36,7 +38,7 @@ sha3 = ["dep:sha3"] [dependencies] actix-http = "3" actix-web = { version = "4", default-features = false } -actix-web-lab = "0.18.5" +actix-web-lab = "0.19" futures-core = "0.3.17" futures-util = { version = "0.3.17", default-features = false, features = ["std"] } local-channel = "0.1" @@ -47,17 +49,18 @@ tracing = { version = "0.1.30", features = ["log"] } digest = "0.10" subtle = "2" blake2 = { package = "blake2", version = "0.10", optional = true } -md5 = { package = "md-5", version = "0.10", optional = true } +blake3 = { package = "blake3", version = "1.3", optional = true, features = ["traits-preview"] } md4 = { package = "md4", version = "0.10", optional = true } +md5 = { package = "md-5", version = "0.10", optional = true } sha1 = { package = "sha1", version = "0.10", optional = true } sha2 = { package = "sha2", version = "0.10", optional = true } sha3 = { package = "sha3", version = "0.10", optional = true } [dev-dependencies] actix-web = "4" -base64 = "0.13" -env_logger = "0.9" -hex-literal = "0.3" +base64 = "0.21" +env_logger = "0.10" +hex-literal = "0.4" [[test]] name = "body_hash" diff --git a/actix-hash/src/lib.rs b/actix-hash/src/lib.rs index 74acd551..ed22040e 100644 --- a/actix-hash/src/lib.rs +++ b/actix-hash/src/lib.rs @@ -3,8 +3,9 @@ //! # Crate Features //! All features are enabled by default. //! - `blake2`: Blake2 types -//! - `md4`: MD4 types 🚩 +//! - `blake3`: Blake3 types //! - `md5`: MD5 types 🚩 +//! - `md4`: MD4 types 🚩 //! - `sha1`: SHA-1 types 🚩 //! - `sha2`: SHA-2 types //! - `sha3`: SHA-3 types @@ -71,3 +72,6 @@ body_hash_alias!(BodySha3_512, sha3::Sha3_512, "sha3", "SHA-3-512", 64); // Blake2 body_hash_alias!(BodyBlake2b, blake2::Blake2b512, "blake2", "Blake2b", 64); body_hash_alias!(BodyBlake2s, blake2::Blake2s256, "blake2", "Blake2s", 32); + +// Blake3 +body_hash_alias!(BodyBlake3, blake3::Hasher, "blake3", "Blake3", 32);