KDFs icon indicating copy to clipboard operation
KDFs copied to clipboard

Missing KDFs

Open tarcieri opened this issue 3 years ago • 8 comments

This is a tracking issue for KDF algorithms we should potentially implement.

Please leave a comment with your requests!

tarcieri avatar Oct 11 '22 00:10 tarcieri

Hi,

It seems the kdf algo from libsodium is missing.

It would be pretty trivial to add it given it's basically a bit of cooking on top of blake2b:

    pub fn kdf_blake2b_derive_from_key::<OutSize>(subkey_id: u64, context: &[u8;8], key: &GenericArray<u8, U32>) -> [u8;OutSize] {
        let mut personal: [u8;16] = [0u8;16];
        personal[..8].copy_from_slice(context);

        let mut salt: [u8;16] = [0u8;16];
        salt[..8].copy_from_slice(&subkey_id.to_le_bytes());

        Blake2bMac<OutSize>::new_with_salt_and_personal(&key, &salt, &personal)
          .expect("subkey has always a valid size")
          .finalize().into()
}

touilleMan avatar Jun 05 '24 22:06 touilleMan

Hello, I would propose ANSI-X9.63-KDF. I have opened a dedicated issue https://github.com/RustCrypto/KDFs/issues/101.

nemynm avatar Oct 04 '24 12:10 nemynm