mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-30 02:49:53 +00:00
feat: add prefix to the ML KEM kdf
This commit is contained in:
parent
a12545b332
commit
01accb788c
@ -97,9 +97,11 @@ impl SharedSecretKey {
|
||||
) -> (Self, EphemeralPublicKey) {
|
||||
use risc0_zkvm::sha::{Impl, Sha256 as _};
|
||||
|
||||
let mut input = [0_u8; 32 + 4];
|
||||
input[0..32].copy_from_slice(message_hash);
|
||||
input[32..36].copy_from_slice(&output_index.to_le_bytes());
|
||||
const PREFIX: &[u8; 21] = b"/LEE/v0.3/KDF-ML-KEM/";
|
||||
let mut input = [0; 21 + 32 + 4];
|
||||
input[0..21].copy_from_slice(PREFIX);
|
||||
input[21..53].copy_from_slice(message_hash);
|
||||
input[53..57].copy_from_slice(&output_index.to_le_bytes());
|
||||
let hash = Impl::hash_bytes(&input);
|
||||
let m: ml_kem::B32 =
|
||||
ml_kem::array::Array::try_from(hash.as_bytes()).expect("SHA-256 output is 32 bytes");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user