HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelibsodium-bindings-0.0.1.1Haskell2010

LibSodium.Bindings.KeyDerivation

  • 6 values

Introduction

0 declarations

From a single, high-entropy key, you can derive multiple secret sub-keys.

This API can derive up to 2⁶⁴ keys from a single key and context, and these sub-keys can have an arbitrary length between 128 (16 bytes) and 512 bits (64 bytes).

Key Generation

valuecryptoKDFDeriveFromKey
  1. :: Ptr CUChar

    Pointer that will hold the sub-key.

  2. -> CSize

    Length of the sub-key.

  3. -> Word64

    Identifier of the sub-key. Must not be reused for another sub-key.

  4. -> Ptr CChar

    Pointer to the context, of size cryptoKDFContextBytes.

  5. -> Ptr CUChar

    Pointer to the master key, which will be of length cryptoKDFKeyBytes.

  6. -> IO CInt

    Returns 0 on success and -1 on error.

#

Derive a sub-key from a high-entropy secre key with a unique identifier. The identifier can be any value up to 2⁶⁴-1

See: crypto_kdf_derive_from_key()

Constants