HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecrypton-1.0.4Haskell2010

Crypto.Cipher.ChaCha

  • 2 types
  • 6 values
  • Packagecrypton-1.0.4
  • Exports8
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • 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.

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

Instances1NFData
  • NFData StateDefined in crypton-1.0.4 · Crypto.Cipher.ChaCha

Simple interface for DRG purpose

3 declarations
newtypenewtype StateSimple
#

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

Instances1NFData