coffio/src/kdf.rs

10 lines
337 B
Rust
Raw Normal View History

2024-02-15 23:45:21 +01:00
pub(crate) fn blake3_derive(context: &[u8], ikm: &[u8]) -> Vec<u8> {
// TODO: remove this hack as soon as `blake3::derive_key` accepts bytes
use std::fmt::Write;
let context: String = context.iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b:02x}");
output
});
blake3::derive_key(&context, ikm).to_vec()
}