Skip to content

tweak belt-dwp bundled ghash, use polyval as inner - #878

Open
makavity wants to merge 4 commits into
RustCrypto:masterfrom
makavity:tweak-dwp-ghash
Open

tweak belt-dwp bundled ghash, use polyval as inner#878
makavity wants to merge 4 commits into
RustCrypto:masterfrom
makavity:tweak-dwp-ghash

Conversation

@makavity

Copy link
Copy Markdown
Contributor
 name                   before.txt ns/iter  after.txt ns/iter   diff ns/iter   diff %  speedup 
 decrypt_aad_only_16kb  18,386 (891 MB/s)   1,523 (10757 MB/s)       -16,863  -91.72%  x 12.07 
 decrypt_msg_only_16kb  91,471 (179 MB/s)   73,526 (222 MB/s)        -17,945  -19.62%   x 1.24 
 encrypt_aad_only_16kb  18,268 (896 MB/s)   1,492 (10981 MB/s)       -16,776  -91.83%  x 12.24 
 encrypt_msg_only_16kb  90,306 (181 MB/s)   73,763 (222 MB/s)        -16,543  -18.32%   x 1.22 

I think, closes RustCrypto/universal-hashes#236

Comment thread belt-dwp/src/ghash.rs
Comment on lines +16 to +25
/// Convert a block between STB 34.101.31's and NIST SP 800-38D's representations.
///
/// Both standards use the same field, but STB numbers the bits of every byte in the opposite
/// order, so the conversion is a bit reversal within each byte.
#[inline(always)]
fn convert(block: &Block) -> Block {
let x = u128::from_le_bytes((*block).into());
x.reverse_bits().swap_bytes().to_le_bytes().into()
}

@makavity makavity Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tarcieri you can take a look, what I told you about in RustCrypto/universal-hashes#356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

polyval, ghash: Add flavors for Little Endian and Big Endian

1 participant