Skip to content

Commit 43f5cba

Browse files
committed
Use SHA3.
1 parent 70af133 commit 43f5cba

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/sensitive_attributes/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ impl SensitiveAttributeBuilder {
168168
let hash_input = create_hash_input(salt.as_slice(), public_key_bytes, &encrypted_value, value);
169169

170170
let version: Integer = 0u64.into(); // version 0
171-
let hashed_and_salted_value: OctetString = HashAlgorithm::Sha2_256.hash(&hash_input).into();
171+
let hashed_and_salted_value: OctetString = HashAlgorithm::Sha3_256.hash(&hash_input).into();
172172
let encrypted_salt: OctetString = encrypted_salt.into();
173-
let hashed_value = SensitiveAttributeHashedValue::new(encrypted_salt, oids::SHA2_256, hashed_and_salted_value);
173+
let hashed_value = SensitiveAttributeHashedValue::new(encrypted_salt, oids::SHA3_256, hashed_and_salted_value);
174174
let nonce = nonce.to_vec();
175175
let cipher = SensitiveAttributeCipher::new(oids::AES_256_GCM, nonce.into(), encrypted_key.into());
176176
let encrypted_value: OctetString = encrypted_value.into();

src/sensitive_attributes/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl SensitiveAttribute {
448448
let hash_input = create_hash_input(&proof_salt, public_key_bytes, &self.encrypted_value, &plaintext_value);
449449

450450
// Hash the concatenated data and compare
451-
let computed_hash = HashAlgorithm::Sha2_256.hash(&hash_input);
451+
let computed_hash = HashAlgorithm::Sha3_256.hash(&hash_input);
452452
Ok(computed_hash.as_slice() == self.hashed_value.value.as_ref())
453453
}
454454

src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pub mod serde_helpers {
170170
match algorithm {
171171
"aes-256-gcm" => Ok(oids::AES_256_GCM),
172172
"sha2-256" => Ok(oids::SHA2_256),
173+
"sha3-256" => Ok(oids::SHA3_256),
173174
_ => Err(E::custom(format!("Unknown algorithm: {algorithm}"))),
174175
}
175176
}

0 commit comments

Comments
 (0)