diff --git a/crates/lox-library/src/bridge_table.rs b/crates/lox-library/src/bridge_table.rs index 43823be..c341d72 100644 --- a/crates/lox-library/src/bridge_table.rs +++ b/crates/lox-library/src/bridge_table.rs @@ -121,8 +121,8 @@ impl BridgeLine { + reachability_priv.x[2] * bucket_attr)) * Btable; res[pos..pos + 4].copy_from_slice(&today.to_le_bytes()); - res[pos + 4..pos + 36].copy_from_slice(&P.compress().as_bytes()[..]); - res[pos + 36..].copy_from_slice(&Q.compress().as_bytes()[..]); + res[pos + 4..pos + 36].copy_from_slice(P.compress().as_bytes()); + res[pos + 36..].copy_from_slice(Q.compress().as_bytes()); } res } diff --git a/crates/lox-library/src/migration_table.rs b/crates/lox-library/src/migration_table.rs index 7973d7a..7bf5357 100644 --- a/crates/lox-library/src/migration_table.rs +++ b/crates/lox-library/src/migration_table.rs @@ -82,9 +82,9 @@ pub fn encrypt_cred( // Serialize (to_bucket, P, Q) let mut credbytes: [u8; MIGRATION_BYTES] = [0; MIGRATION_BYTES]; - credbytes[0..32].copy_from_slice(&to_bucket.as_bytes()[..]); - credbytes[32..64].copy_from_slice(&P.compress().as_bytes()[..]); - credbytes[64..].copy_from_slice(&Q.compress().as_bytes()[..]); + credbytes[0..32].copy_from_slice(to_bucket.as_bytes()); + credbytes[32..64].copy_from_slice(P.compress().as_bytes()); + credbytes[64..].copy_from_slice(Q.compress().as_bytes()); // Pick a random nonce let mut noncebytes: [u8; 12] = [0; 12]; @@ -93,9 +93,9 @@ pub fn encrypt_cred( // Compute the hash of (id, from_bucket, Qk) let mut hasher = Sha256::new(); - hasher.update(&id.as_bytes()[..]); - hasher.update(&from_bucket.as_bytes()[..]); - hasher.update(&Qk.compress().as_bytes()[..]); + hasher.update(id.as_bytes()); + hasher.update(from_bucket.as_bytes()); + hasher.update(Qk.compress().as_bytes()); let fullhash = hasher.finalize(); // Create the encryption key from the 2nd half of the hash @@ -182,9 +182,9 @@ pub fn decrypt_cred( ) -> Option { // Compute the hash of (id, from_bucket, Qk) let mut hasher = Sha256::new(); - hasher.update(&lox_id.as_bytes()[..]); - hasher.update(&from_bucket.as_bytes()[..]); - hasher.update(&Qk.compress().as_bytes()[..]); + hasher.update(lox_id.as_bytes()); + hasher.update(from_bucket.as_bytes()); + hasher.update(Qk.compress().as_bytes()); let fullhash = hasher.finalize(); // Use the first half of the above hash as the label