WringTwistree-0.0.1.1: Whole-message cipher and tree hash
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cryptography.Wring

Synopsis

Documentation

data Wring Source #

Instances

Instances details
Show Wring Source # 
Instance details

Defined in Cryptography.Wring

Methods

showsPrec :: Int -> Wring -> ShowS #

show :: Wring -> String #

showList :: [Wring] -> ShowS #

mix3Parts :: Vector Word8 -> Int -> Vector Word8 Source #

Splits buf into three equal parts, with 0-2 bytes left over, and mixes the three parts. Exported for testing.

permut8 :: Seq a -> Word16 -> Seq a Source #

Permutes a Seq of eight bytes. Exported for testing.

mul65537 :: Word16 -> Word16 -> Word16 Source #

Multiplies two nonzero numbers mod 65537. Exported for testing.

wringName :: Wring -> String Source #

Generates a name from the first four bytes of the S-box. Used to tag events in a profiling log.

xorn :: (Integral a, Bits a) => a -> Word8 Source #

Exclusive-ors all bytes in a nonnegative number. The only reason this function is public is that it's used to generate a long ByteString for a test.

linearWring :: Wring Source #

A Wring with linear S-boxes. Used only for testing and cryptanalysis.

keyedWring :: ByteString -> Wring Source #

Creates a Wring with the given key. To convert a String to a ByteString, put - utf8-string in your package.yaml dependencies, import Data.ByteString.UTF8, and use fromString.

encrypt Source #

Arguments

:: Wring

The Wring made with the key to encrypt with

-> Vector Word8

The plaintext

-> Vector Word8

The returned ciphertext

Encrypts a message.

decrypt Source #

Arguments

:: Wring

The Wring made with the key to decrypt with

-> Vector Word8

The ciphertext

-> Vector Word8

The returned plaintext

Decrypts a message.

encryptFixed :: Wring -> Vector Word8 -> Vector Word8 Source #

Used only for cryptanalysis