Hashlen update

This commit is contained in:
Jazz Turner-Baggs 2026-04-29 07:18:14 -07:00
parent ea06cf5186
commit fbb64408d1
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -73,7 +73,7 @@ impl InboxProtocolParams {
}
fn conversation_id_for_account_id(account_id: &AccountId) -> String {
blake2b_hex::<hash_size::Testing>(&["InboxV2|", "conversation_id|", account_id.as_str()])
blake2b_hex::<hash_size::ConvoId>(&["InboxV2|", "conversation_id|", account_id.as_str()])
}
}

View File

@ -1,3 +1,4 @@
use blake2::{Blake2b, Digest};
use std::time::{SystemTime, UNIX_EPOCH};
pub fn timestamp_millis() -> i64 {
@ -33,16 +34,15 @@ pub mod hash_size {
};
}
use blake2::digest::consts::{U4, U8};
use blake2::digest::consts::{U6, U8};
hash_sizes! {
/// Generic hash size for tests and debug
Testing => U4,
/// Account ID hash length
AccountId => U8,
/// Conversation ID hash length
ConvoId => U6,
}
}
use blake2::{Blake2b, Digest};
/// This establishes an easy to use wrapper for hashes in this crate.
/// The output is formatted string of hex characters
pub fn blake2b_hex<LEN: hash_size::HashLen>(components: &[impl AsRef<[u8]>]) -> String {