INNER CODE UNIT · Rust

last_block_in_lane

brndnmtthws/dryoc · src/argon2/mod.rs:427

        let last_block_in_lane = (l * instance.lane_length + (instance.lane_length - 1)) as usize;
        xor_block(&mut blockhash, &instance.region.memory[last_block_in_lane]);
    }

    let mut blockhash_bytes = Zeroizing::new([0u8; ARGON2_BLOCK_SIZE]);
    store_block(&mut blockhash_bytes[..], &blockhash);
    blake2b::longhash(context.output, &blockhash_bytes[..])
}

fn argon2_initial_hash(
    context: &Argon2Context,
    type_: Argon2Type,
) -> Result<Zeroizing<[u8; ARGON2_PREHASH_SEED_LENGTH]>, Error> {
    let mut blake2b = blake2b::State::init(ARGON2_PREHASH_DIGEST_LENGTH as u8, None, None, None)?;
    blake2b.update(&context.lanes.to_le_bytes());
    blake2b.update(&(context.output.len() as u32).to_le_bytes());
    blake2b.update(&context.m_cost.to_le_bytes());
    blake2b.update(&context.t_cost.to_le_bytes());

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…