Copyright | (c) Alfredo Garcia 2023 |
---|---|
License | MIT |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The Crypt
module provides functions for Salsa20 encryption and decryption. Salsa20 is a symmetric key stream cipher designed for fast and secure encryption of data.
This module includes functions to calculate an index over 64, generate Salsa20 expansion matrices,
encrypt or decrypt messages using 16-byte and 32-byte keys, and display encryption details as strings or equations.
The module ensures the uniqueness and security of encryption keys by utilizing nonces and augmented keys.
The Salsa20 algorithm is widely used in various cryptographic applications due to its strong security and high performance. Users can employ the functions provided by this module to secure their data with Salsa20 encryption and, if needed, perform decryption to retrieve the original content.
Please refer to the individual function documentation for specific details and usage guidelines.
Synopsis
- cryptBlock16Compute :: [Word32] -> [Word32] -> [Word32] -> Int -> [Word32]
- cryptBlock16Display :: [String] -> [String] -> [String] -> Int -> [String]
- cryptBlock32Compute :: [Word32] -> [Word32] -> [Word32] -> [Word32] -> Int -> [Word32]
- cryptBlock32Display :: [String] -> [String] -> [String] -> [String] -> Int -> [String]
Documentation
cryptBlock16Compute :: [Word32] -> [Word32] -> [Word32] -> Int -> [Word32] #
Encrypt or decrypt a message using a single 16-byte key and return a encrypted/decrypted message of the same length.
It takes a list of Word32
values of any length (message block), a 16-byte key, an 8-byte nonce, and an index representing
the position of the message byte.
The function performs XOR operations on the message block and the corresponding Salsa20 expansion matrix entry.
cryptBlock16Display :: [String] -> [String] -> [String] -> Int -> [String] #
Display the encryption or decryption of a message with a single 16 bytes key as a list of strings.
cryptBlock32Compute :: [Word32] -> [Word32] -> [Word32] -> [Word32] -> Int -> [Word32] #
Encrypt or decrypt a message using a 32-byte key and return a encrypted/decrypted message of the same length.
It takes a list of Word32
values of any length (message block), two 16-byte keys, an 8-byte nonce, and an index representing
the position of the message byte.
The function performs XOR operations on the message block and the corresponding Salsa20 expansion matrix entry.