salsa20-0.1.0.0
Copyright(c) Alfredo Garcia 2023
LicenseMIT
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Expansion

Description

This module implements the Salsa20 expansion function, which is an essential part of the Salsa20 stream cipher. The expansion function derives the internal key schedule from the provided key and nonce, preparing the cipher for data encryption and decryption.

There are two variants of the expansion function based on the key size:

  1. expand32: Used with 32-byte (256-bit) keys.
  2. expand16: Used with 16-byte (128-bit) keys.

Each of these functions takes a key and nonce as input and produces the Salsa20 keystream as output. The 32-byte version is the most commonly used variant in practice.

The module provides functions for computing, displaying, and generating equations for both expand32 and expand16 operations. The internal order and constants used in these functions are also defined within this module for clarity.

Synopsis

Documentation

expand32Compute :: [Word32] -> [Word32] -> [Word32] -> [Word32] #

The expansion function where we have two 16 bytes k's (k0 and k1).

expand32Display :: [String] -> [String] -> [String] -> [String] #

The expansion function displayed where we have two 16 bytes (k0 and k1).

expand16Compute :: [Word32] -> [Word32] -> [Word32] #

The expansion function computed where we have one 16 bytes (k).

expand16Display :: [String] -> [String] -> [String] #

The expansion function displayed where we have one 16 bytes (k).