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

Cryptography.Twistree

Synopsis

Documentation

data Twistree Source #

Instances

Instances details
Show Twistree Source # 
Instance details

Defined in Cryptography.Twistree

type SBox = Vector Word8 Source #

Three 8×8 S-boxes used alternately to substitute bytes

sboxes :: ByteString -> SBox Source #

Computes S-boxes from a key. Exported for cryptanalysis.

sameBitcount :: SBox -> [Word8] Source #

Returns a list of the bytes which, when looked up in the S-boxes, give three bytes (which may be the same) with the same bitcount. For cryptanalysis of the hash function.

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

Compresses two or three 32-byte blocks into one. Exported for cryptanalysis.

linearSbox :: SBox Source #

A linear SBox used for cryptanalysis

linearTwistree :: Twistree Source #

A Twistree with linear SBox. Used only for testing and cryptanalysis.

parListDeal Source #

Arguments

:: Int

n, the number of threads

-> Strategy a 
-> Strategy [a] 

Deals a list among threads; each thread evaluates the items of its part of the list in sequence, and all the threads run in parallel. If n is 12, the 0th, 12th, 24th, ... items are evaluated by one thread, the 1st, 13rd, 25th, ... items are evaluated by another thread, and so on.

keyedTwistree :: ByteString -> Twistree Source #

Creates a Twistree 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.

hash Source #

Arguments

:: Twistree

The Twistree made with the key to hash with

-> ByteString

The text to be hashed. It's a lazy ByteString, so you can hash a file bigger than RAM.

-> Vector Word8

The returned hash, 32 bytes.