Skip to content
FutureBlitz

    Install

    Import std.crypto.derive

    Hkdf

    std.crypto.derive

    struct

    Public Struct Hkdf

    HKDF (RFC 5869): length bytes of new key from material, a secret like a shared one from X25519, with salt, which can be empty, and info, which says what the key is for, so keys for different uses differ.

    Examples

    Local shared = SecureRandom.Bytes(32)
    Local key = Hkdf.Sha256(shared, [], "session keys".Bytes, 32)
    Expect(key.Count == 32)
    Expect(key == Hkdf.Sha256(shared, [], "session keys".Bytes, 32))

    std/crypto/derive.fb, line 72

    • @PanicsAtCaller Public Static Method Sha256(material: UInt8[], salt: UInt8[], info: UInt8[], length: Int): UInt8[] static method #

      length bytes of key from material, salt, and info, by HMAC-SHA256. Panics unless length is from 0 to 8160, 255 hashes.

    • @PanicsAtCaller Public Static Method Sha512(material: UInt8[], salt: UInt8[], info: UInt8[], length: Int): UInt8[] static method #

      length bytes of key from material, salt, and info, by HMAC-SHA512. Panics unless length is from 0 to 16320, 255 hashes.

    Report an issue with this page or with FutureBlitz on GitHub.