Copyright | (c) Alfredo Garcia 2023 |
---|---|
License | MIT |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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:
expand32
: Used with 32-byte (256-bit) keys.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
- expand32Compute :: [Word32] -> [Word32] -> [Word32] -> [Word32]
- expand32Display :: [String] -> [String] -> [String] -> [String]
- expand16Compute :: [Word32] -> [Word32] -> [Word32]
- expand16Display :: [String] -> [String] -> [String]
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).