HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulecrypton-2.1.7Haskell2010

Crypto.Cipher.ChaCha

Contents
  1. Simple interface for DRG purpose
  2. Seeking and cursor for DRG purposes
Synopsis
  • 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.

newtypenewtype State

ChaCha context

Instances2NFData, ChaChaState

Simple interface for DRG purpose

Seeking and cursor for DRG purposes