Skip to content

blake2b avx2 impl #2667

@rakita

Description

@rakita

Have looked around and found avx2 code impl that we can reuse: https://github.com/oconnor663/blake2_simd/blob/82b3e2aee4d2384aabbeb146058301ff0dbd453f/blake2b/src/avx2.rs#L146-L424

And it should replace this fn

pub fn compress(rounds: usize, h: &mut [u64; 8], m: [u64; 16], t: [u64; 2], f: bool) {

There are few modification that needs to be done. Eth precompile has N round so we need to check if round counter has expired or not more often. Inputs that I can deduce areblock is m, words is h, count is t.last_block looks like a mask for f but not sure what last_node is.

This algorithm aligns with what Nethermind has https://github.com/NethermindEth/nethermind/blob/cc953a1e1375d1d8133b92655211597336709412/src/Nethermind/Nethermind.Crypto/Blake2/Blake2Avx2.cs#L48-L697

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or lib ability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions