|
@@ -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<Migration> {
|
|
|
// 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
|