threefish-0.2.4: The Threefish block cipher and the Skein hash function for Haskell.

Safe HaskellNone

Crypto.Threefish.Random

Description

Skein 256 as a PRNG.

Synopsis

Documentation

data SkeinGen Source

Skein-based PRNG as defined in the Skein 1.3 paper.

class RandomGen g where

Methods

next :: g -> (Int, g)

genRange :: g -> (Int, Int)

split :: g -> (g, g)

Instances

newSkeinGen :: IO SkeinGenSource

Create a new Skein PRNG from the system's entropy pool.

mkSkeinGen :: Serialize a => a -> SkeinGenSource

Create a Skein PRNG from a seed.

mkSkeinGenEx :: Int -> Block256 -> SkeinGenSource

Create a Skein PRNG with a custom pool size. Larger pool sizes give faster random data, but obviously take up more memory. Pool size is preserved across splits.

randomBytes :: Int -> SkeinGen -> (ByteString, SkeinGen)Source

Generate n random bytes using the given generator.

reseedSkeinGen :: Block256 -> SkeinGen -> SkeinGenSource

Reseed a Skein PRNG.

toBlock :: Threefish a b => ByteString -> Maybe aSource

Create an appropriately sized block.

fromBlock :: Threefish a b => a -> ByteStringSource

Extract the contents of a block.