HORIZON HASKELLDocslts/ghc-10.0.xaa25b892026-10-10Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · aa25b89 · 2026-10-10

Modulecrypton-2.1.7Haskell2010

Crypto.Cipher.ChaCha

  • 2 types
  • 1 class
  • 7 values
  • Packagecrypton-2.1.7
  • Exports10
  • LanguageHaskell2010
  • LicenceBSD-3-Clause AND MIT AND ISC
  • SourceChaCha.hs
valueinitialize
  1. :: (ByteArrayAccess key, ByteArrayAccess nonce)
  2. => Int

    number of rounds (8,12,20)

  3. -> key

    the key (128 or 256 bits)

  4. -> nonce

    the nonce (64 or 96 bits)

  5. -> State

    the initial ChaCha state

#

Initialize a new ChaCha context with the number of rounds, the key and the nonce associated. To use ChaCha20 defined in RFC 8439, 20, 256bits-key and 96-bits nonce must be used.

valueinitializeX
  1. :: (ByteArrayAccess key, ByteArrayAccess nonce)
  2. => Int

    number of rounds (8,12,20)

  3. -> key

    the key (256 bits)

  4. -> nonce

    the nonce (192 bits)

  5. -> State

    the initial ChaCha state

#

Initialize a new XChaCha context with the number of rounds, the key and the nonce associated.

An XChaCha state can be used like a regular ChaCha state after initialisation.

valuecombine
  1. :: ByteArray ba
  2. => State

    the current ChaCha state

  3. -> ba

    the source to xor with the generator

  4. -> (ba, State)
#

Combine the chacha output and an arbitrary message with a xor, and return the combined output and the new state.

valuegenerate
  1. :: ByteArray ba
  2. => State

    the current ChaCha state

  3. -> Int

    the length of data to generate

  4. -> (ba, State)
#

Generate a number of bytes from the ChaCha output directly

newtypenewtype State
#

ChaCha context

Instances2NFData, ChaChaState

Simple interface for DRG purpose

3 declarations
newtypenewtype StateSimple
#

ChaCha context for DRG purpose (see Crypto.Random.ChaChaDRG)

Instances2NFData, ChaChaState

Seeking and cursor for DRG purposes

2 declarations