From e6bf497500aa4c0a43a375b7d71892328ff63a6d Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Mon, 20 Feb 2023 23:46:21 -0800 Subject: [PATCH 1/2] chore: update dependencies --- Cargo.toml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 902fe7d..d4d7733 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,16 @@ [package] name = "miden-crypto" version = "0.1.3" -description="Miden Cryptographic primitives" +description = "Miden Cryptographic primitives" authors = ["miden contributors"] -readme="README.md" +readme = "README.md" license = "MIT" repository = "https://github.com/0xPolygonMiden/crypto" +documentation = "https://docs.rs/miden-crypto/0.1.3" categories = ["cryptography", "no-std"] keywords = ["miden", "crypto", "hash", "merkle"] edition = "2021" +rust-version = "1.67" [[bench]] name = "hash" @@ -23,12 +25,12 @@ default = ["blake3/default", "std", "winter_crypto/default", "winter_math/defaul std = ["blake3/std", "winter_crypto/std", "winter_math/std", "winter_utils/std"] [dependencies] -blake3 = { version = "1.0", default-features = false } -winter_crypto = { version = "0.5.1", package = "winter-crypto", default-features = false } -winter_math = { version = "0.5.1", package = "winter-math", default-features = false } -winter_utils = { version = "0.5.1", package = "winter-utils", default-features = false } +blake3 = { version = "1.3", default-features = false } +winter_crypto = { version = "0.5", package = "winter-crypto", default-features = false } +winter_math = { version = "0.5", package = "winter-math", default-features = false } +winter_utils = { version = "0.5", package = "winter-utils", default-features = false } [dev-dependencies] criterion = { version = "0.4", features = ["html_reports"] } -proptest = "1.0.0" -rand_utils = { version = "0.4", package = "winter-rand-utils" } +proptest = "1.1.0" +rand_utils = { version = "0.5", package = "winter-rand-utils" } From 35b255b5eb26db7e4ea842bd266597fc6f72676b Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Wed, 22 Feb 2023 11:12:17 +0100 Subject: [PATCH 2/2] feat: re-export winter-crypto Hasher, Digest & ElementHasher This commit introduces the re-export of the listed primitives. They will be used inside Miden to report the security level of the picked primitive, as well as other functionality. closes #72 --- CHANGELOG.md | 4 ++++ Cargo.toml | 4 ++-- src/hash/blake/mod.rs | 3 +++ src/hash/mod.rs | 6 +++++- src/hash/rpo/mod.rs | 1 + src/lib.rs | 2 -- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc51ca..767f151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.4 (2023-02-22) + +- Re-export winter-crypto Hasher, Digest & ElementHasher (#72) + ## 0.1.3 (2023-02-20) - Updated Winterfell dependency to v0.5.1 (#68) diff --git a/Cargo.toml b/Cargo.toml index d4d7733..49041ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-crypto" -version = "0.1.3" -description = "Miden Cryptographic primitives" +version = "0.1.5" +description="Miden Cryptographic primitives" authors = ["miden contributors"] readme = "README.md" license = "MIT" diff --git a/src/hash/blake/mod.rs b/src/hash/blake/mod.rs index 578b86c..5255228 100644 --- a/src/hash/blake/mod.rs +++ b/src/hash/blake/mod.rs @@ -78,6 +78,7 @@ impl Digest for Blake3Digest { // ================================================================================================ /// 256-bit output blake3 hasher. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Blake3_256; impl Hasher for Blake3_256 { @@ -141,6 +142,7 @@ impl Blake3_256 { // ================================================================================================ /// 192-bit output blake3 hasher. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Blake3_192; impl Hasher for Blake3_192 { @@ -204,6 +206,7 @@ impl Blake3_192 { // ================================================================================================ /// 160-bit output blake3 hasher. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Blake3_160; impl Hasher for Blake3_160 { diff --git a/src/hash/mod.rs b/src/hash/mod.rs index 9508754..d295cbe 100644 --- a/src/hash/mod.rs +++ b/src/hash/mod.rs @@ -1,5 +1,9 @@ use super::{Felt, FieldElement, StarkField, ONE, ZERO}; -use winter_crypto::{Digest, ElementHasher, Hasher}; pub mod blake; pub mod rpo; + +// RE-EXPORTS +// ================================================================================================ + +pub use winter_crypto::{Digest, ElementHasher, Hasher}; diff --git a/src/hash/rpo/mod.rs b/src/hash/rpo/mod.rs index 122519f..1cde967 100644 --- a/src/hash/rpo/mod.rs +++ b/src/hash/rpo/mod.rs @@ -88,6 +88,7 @@ const INV_ALPHA: u64 = 10540996611094048183; /// to deserialize them into field elements and then hash them using /// [hash_elements()](Rpo256::hash_elements) function rather then hashing the serialized bytes /// using [hash()](Rpo256::hash) function. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Rpo256(); impl Hasher for Rpo256 { diff --git a/src/lib.rs b/src/lib.rs index a68c2bf..0b0386b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,9 +11,7 @@ pub mod merkle; // ================================================================================================ pub use winter_crypto::{RandomCoin, RandomCoinError}; - pub use winter_math::{fields::f64::BaseElement as Felt, FieldElement, StarkField}; - pub mod utils { pub use winter_utils::{ collections, string, uninit_vector, ByteReader, ByteWriter, Deserializable,