Documentation ¶
Overview ¶
Package lioness implements the LIONESS Large Block Cipher with some modifications: Instead of using a standard stream cipher, it only allows usage of block ciphers that implement the cipher.Block interface. Furthermore it does not use the suggested hash operation but instead uses an HMAC everywhere a hash is used in the original design Paper: http://www.cl.cam.ac.uk/~rja14/Papers/bear-lion.pdf In addition, this implementation supports two modes. ModeZero, which uses an all zero IV for the R-operation, and ModeIV, which uses the content of L as the IV.
Index ¶
Examples ¶
Constants ¶
const ( // ModeIV uses L as the IV for encryption ModeIV = iota // ModeZero uses all zeros as the IV for encryption ModeZero )
Variables ¶
var ( // ErrConstructed is returned if working with a lioness that hasn't been set up ErrConstructed = errors.New("lioness: Missing setup") // ErrKeyHashSize is returned if the key size is larger than the hash size ErrKeyHashSize = errors.New("lioness: Hash smaller than key") // ErrKeyLen is returned when the keys given do not match the key length ErrKeyLen = errors.New("lioness: Keys have wrong size") // ErrDataSize is returned when the data is too small (<=keylen) ErrDataSize = errors.New("lioness: Not enough data") // ErrNoKeys is returned if using a lioness without keys ErrNoKeys = errors.New("lioness: Keys not set") )
Functions ¶
This section is empty.
Types ¶
type Lioness ¶
type Lioness struct {
// contains filtered or unexported fields
}
Lioness holds internal data
func Construct ¶
func Construct(blockcipher func([]byte) (cipher.Block, error), hash func() hash.Hash, keylen int, key []byte, mode int) (*Lioness, error)
Construct returns a new Lioness. Takes block cipher, hash function and keylen. Key can be nil. mode is either ModeIV or ModeZero
Example ¶
Output: Data after decryption: Some data to be encrypted. It must be long enough to cover at least one key length.
func New ¶
New is shorthand for Construct with aes256 and sha256 in ModeZero
Example ¶
Output: Data after decryption: Some data to be encrypted. It must be long enough to cover at least one key length.
func (*Lioness) ExplodeKey ¶
ExplodeKey generates the Lioness keys from a single input key by calculating repeated HMACs (which is of questionable security)