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

Add pure-Rust Blake2 #755

Merged
merged 12 commits into from
Jan 23, 2025
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"poly1305",
"chacha20poly1305",
"rsa",
"blake2",
]

[workspace.package]
Expand Down
15 changes: 15 additions & 0 deletions blake2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "libcrux-blake2"
description = "Formally verified blake2 hash library"

version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
edition.workspace = true
repository.workspace = true
readme.workspace = true

[dependencies]
libcrux-hacl-rs = { version = "=0.0.2-beta.2", path = "../hacl-rs/" }
libcrux-macros = { version = "=0.0.2-beta.2", path = "../macros" }
1,467 changes: 1,467 additions & 0 deletions blake2/src/hacl/hash_blake2b.rs

Large diffs are not rendered by default.

1,385 changes: 1,385 additions & 0 deletions blake2/src/hacl/hash_blake2s.rs

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions blake2/src/hacl/impl_blake2_constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(unused_assignments)]
#![allow(unreachable_patterns)]

pub(crate) const sigmaTable: [u32; 160] = [
0u32, 1u32, 2u32, 3u32, 4u32, 5u32, 6u32, 7u32, 8u32, 9u32, 10u32, 11u32, 12u32, 13u32, 14u32,
15u32, 14u32, 10u32, 4u32, 8u32, 9u32, 15u32, 13u32, 6u32, 1u32, 12u32, 0u32, 2u32, 11u32,
7u32, 5u32, 3u32, 11u32, 8u32, 12u32, 0u32, 5u32, 2u32, 15u32, 13u32, 10u32, 14u32, 3u32, 6u32,
7u32, 1u32, 9u32, 4u32, 7u32, 9u32, 3u32, 1u32, 13u32, 12u32, 11u32, 14u32, 2u32, 6u32, 5u32,
10u32, 4u32, 0u32, 15u32, 8u32, 9u32, 0u32, 5u32, 7u32, 2u32, 4u32, 10u32, 15u32, 14u32, 1u32,
11u32, 12u32, 6u32, 8u32, 3u32, 13u32, 2u32, 12u32, 6u32, 10u32, 0u32, 11u32, 8u32, 3u32, 4u32,
13u32, 7u32, 5u32, 15u32, 14u32, 1u32, 9u32, 12u32, 5u32, 1u32, 15u32, 14u32, 13u32, 4u32,
10u32, 0u32, 7u32, 6u32, 3u32, 9u32, 2u32, 8u32, 11u32, 13u32, 11u32, 7u32, 14u32, 12u32, 1u32,
3u32, 9u32, 5u32, 0u32, 15u32, 4u32, 8u32, 6u32, 2u32, 10u32, 6u32, 15u32, 14u32, 9u32, 11u32,
3u32, 0u32, 8u32, 12u32, 2u32, 13u32, 7u32, 1u32, 4u32, 10u32, 5u32, 10u32, 2u32, 8u32, 4u32,
7u32, 6u32, 1u32, 5u32, 15u32, 11u32, 9u32, 14u32, 3u32, 12u32, 13u32, 0u32,
];

pub(crate) const ivTable_S: [u32; 8] = [
0x6A09E667u32,
0xBB67AE85u32,
0x3C6EF372u32,
0xA54FF53Au32,
0x510E527Fu32,
0x9B05688Cu32,
0x1F83D9ABu32,
0x5BE0CD19u32,
];

pub(crate) const ivTable_B: [u64; 8] = [
0x6A09E667F3BCC908u64,
0xBB67AE8584CAA73Bu64,
0x3C6EF372FE94F82Bu64,
0xA54FF53A5F1D36F1u64,
0x510E527FADE682D1u64,
0x9B05688C2B3E6C1Fu64,
0x1F83D9ABFB41BD6Bu64,
0x5BE0CD19137E2179u64,
];
Loading
Loading