fn scrypt_block_mix(input: &[u8], output: &mut [u8]) {
    let mut x = [0u8; 64];
    x.copy_from_slice(&input[input.len() - 64..]);

    let mut t = [0u8; 64];

    for (i, chunk) in input.chunks(64).enumerate() {
        xor(&x, chunk, &mut t);

        let mut t2 = [0u32; 16];

        for (c, b) in t.chunks_exact(4).zip(t2.iter_mut()) {
            *b = u32::from_le_bytes(c.try_into().unwrap());
        }

        Salsa20_8::from(t2).generate(&mut x);

        let pos = if i % 2 == 0 {
            (i / 2) * 64
        } else {
            (i / 2) * 64 + input.len() / 2
        };

        output[pos..pos + 64].copy_from_slice(&x);
    }
}
/// Execute the BlockMix operation
/// input - the input vector. The length must be a multiple of 128.
/// output - the output vector. Must be the same length as input.
Execute the BlockMix operation
input - the input vector. The length must be a multiple of 128.
output - the output vector. Must be the same length as input.
Execute the BlockMix operation input - the input vector . The length must be a multiple of 128 . output - the output vector . Must be the same length as input .
fn scrypt_block_mix(input: &[u8], output: &mut [u8]) {
    let mut x = [0u8; 64];
    x.copy_from_slice(&input[input.len() - 64..]);
    let mut t = [0u8; 64];
    for (i, chunk) in input.chunks(64).enumerate() {
        xor(&x, chunk, &mut t);
        let mut t2 = [0u32; 16];
        for (c, b) in t.chunks_exact(4).zip(t2.iter_mut()) {
            *b = u32::from_le_bytes(c.try_into().unwrap());
        }
        Salsa20_8::from(t2).generate(&mut x);
        let pos = if i % 2 == 0 {
            (i / 2) * 64
        } else {
            (i / 2) * 64 + input.len() / 2
        };
        output[pos..pos + 64].copy_from_slice(&x);
    }
}
fn scrypt_block_mix ( input : & [ u8 ] , output : & mut [ u8 ] ) { let mut x = [ 0u8 ; 64 ] ; x . copy_from_slice ( & input [ input . len ( ) - 64 .. ] ) ; let mut t = [ 0u8 ; 64 ] ; for ( i , chunk ) in input . chunks ( 64 ) . enumerate ( ) { xor ( & x , chunk , & mut t ) ; let mut t2 = [ 0u32 ; 16 ] ; for ( c , b ) in t . chunks_exact ( 4 ) . zip ( t2 . iter_mut ( ) ) { * b = u32 :: from_le_bytes ( c . try_into ( ) . unwrap ( ) ) ; } Salsa20_8 :: from ( t2 ) . generate ( & mut x ) ; let pos = if i % 2 == 0 { ( i / 2 ) * 64 } else { ( i / 2 ) * 64 + input . len ( ) / 2 } ; output [ pos .. pos + 64 ] . copy_from_slice ( & x ) ; } }
Execute the BlockMix operation
input - the input vector.
Execute the BlockMix operation input - the input vector .
input
&[u8]
output
&mut [u8]
input
&[u8]
output
&mut [u8]