| Copyright | (c) Joseph Abrahamson 2013 |
|---|---|
| License | MIT |
| Maintainer | me@jspha.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Crypto.Saltine.Class
Description
Saltine type classes
- class IsEncoding a where
- encode :: a -> ByteString
- decode :: ByteString -> Maybe a
- encoded :: (Choice p, Applicative f) => p a (f a) -> p ByteString (f ByteString)
- class IsNonce n where
Documentation
class IsEncoding a where Source
Class for all keys and nonces in Saltine which have a
representation as Vector of Word8. encoded is a Prism of
type Prism' (V.Vector Word8) a compatible with Control.Lens and
is automatically deduced.
Methods
encode :: a -> ByteString Source
decode :: ByteString -> Maybe a Source
encoded :: (Choice p, Applicative f) => p a (f a) -> p ByteString (f ByteString) Source
Instances
A generic class for interacting with nonces.
Methods
Some privileged nonce value.
Some perturbation on nonces such that n /= nudge n with high
probability. Since nonces are finite, repeats may happen in
particularly small cases, but no nonces in Saltine are so
small. This is not guaranteed to be difficult to predict---if a
nonce had an Enum instance succ would be a good
implementation excepting that succ is partial.