// Execute the ROMix operation in-place.
// b - the data to operate on
// v - a temporary variable to store the vector V
// t - a temporary variable to store the result of the xor
// n - the scrypt parameter N
Execute the ROMix operation in-place.
b - the data to operate on
v - a temporary variable to store the vector V
t - a temporary variable to store the result of the xor
n - the scrypt parameter N
Execute the ROMix operation in - place . b - the data to operate on v - a temporary variable to store the vector V t - a temporary variable to store the result of the xor n - the scrypt parameter N
fn scrypt_ro_mix(b: &mut [u8], v: &mut [u8], t: &mut [u8], n: uint) {
    fn integerify(x: &[u8], n: uint) -> uint {
        // n is a power of 2, so n - 1 gives us a bitmask that we can use to perform a calculation
        // mod n using a simple bitwise and.
        let mask = n - 1;
        // This cast is safe since we're going to get the value mod n (which is a power of 2), so we
        // don't have to care about truncating any of the high bits off
        let result = (read_u32_le(x.slice(x.len() - 64, x.len() - 60)) as uint) & mask;
        return result;
    }
    let len = b.len();
    for chunk in v.mut_chunks(len) {
        chunk.clone_from_slice(b);
        scrypt_block_mix(chunk, b);
    }
    for _ in range(0, n) {
        let j = integerify(b, n);
        xor(b, v.slice(j * len, (j + 1) * len), t);
        scrypt_block_mix(t, b);
    }
}
fn scrypt_ro_mix ( b : & mut [ u8 ] , v : & mut [ u8 ] , t : & mut [ u8 ] , n : uint ) { fn integerify ( x : & [ u8 ] , n : uint ) -> uint { // n is a power of 2, so n - 1 gives us a bitmask that we can use to perform a calculation // mod n using a simple bitwise and. let mask = n - 1 ; // This cast is safe since we're going to get the value mod n (which is a power of 2), so we // don't have to care about truncating any of the high bits off let result = ( read_u32_le ( x . slice ( x . len ( ) - 64 , x . len ( ) - 60 ) ) as uint ) & mask ; return result ; } let len = b . len ( ) ; for chunk in v . mut_chunks ( len ) { chunk . clone_from_slice ( b ) ; scrypt_block_mix ( chunk , b ) ; } for _ in range ( 0 , n ) { let j = integerify ( b , n ) ; xor ( b , v . slice ( j * len , ( j + 1 ) * len ) , t ) ; scrypt_block_mix ( t , b ) ; } }
Execute the ROMix operation in-place.
Execute the ROMix operation in - place .
b
&mut [u8]
v
&mut [u8]
t
&mut [u8]
n
uint