| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Crypto.Lazy
Synopsis
- sha256Hash :: LazyByteString -> ByteString
- sha512Hash :: LazyByteString -> ByteString
- pad :: LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString
- unPad :: LazyByteString -> Either CryptoError LazyByteString
- splitLen :: LazyByteString -> Either CryptoError (Int64, LazyByteString)
- sbEncrypt :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString
- sbDecrypt :: SbKey -> CbNonce -> LazyByteString -> Either CryptoError LazyByteString
- sbEncryptTailTag :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString
- kcbEncryptTailTag :: KEMHybridSecret -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString
- sbDecryptTailTag :: SbKey -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)
- kcbDecryptTailTag :: KEMHybridSecret -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)
- sbEncryptTailTagNoPad :: SbKeyNonce -> LazyByteString -> Either CryptoError LazyByteString
- sbDecryptTailTagNoPad :: SbKeyNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString)
- fastReplicate :: Int64 -> Char -> LazyByteString
- secretBox :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError (NonEmpty ByteString)
- secretBoxTailTag :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError [ByteString]
- type SbState = (State, State)
- cbInit :: DhSecretX25519 -> CbNonce -> Either CryptoError SbState
- sbInit :: SbKey -> CbNonce -> Either CryptoError SbState
- kcbInit :: KEMHybridSecret -> CbNonce -> Either CryptoError SbState
- sbEncryptChunk :: SbState -> ByteString -> (ByteString, SbState)
- sbDecryptChunk :: SbState -> ByteString -> (ByteString, SbState)
- sbEncryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState)
- sbDecryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState)
- sbAuth :: SbState -> Auth
- type LazyByteString = ByteString
Documentation
sha256Hash :: LazyByteString -> ByteString Source #
SHA512 digest of a lazy bytestring.
sha512Hash :: LazyByteString -> ByteString Source #
SHA512 digest of a lazy bytestring.
pad :: LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #
unPad :: LazyByteString -> Either CryptoError LazyByteString Source #
splitLen :: LazyByteString -> Either CryptoError (Int64, LazyByteString) Source #
sbEncrypt :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #
NaCl secret_box lazy encrypt with a symmetric 256-bit key and 192-bit nonce.
The resulting string will be bigger than paddedLen by the size of the auth tag (16 bytes).
sbDecrypt :: SbKey -> CbNonce -> LazyByteString -> Either CryptoError LazyByteString Source #
NaCl secret_box decrypt with a symmetric 256-bit key and 192-bit nonce.
The resulting string will be smaller than packet size by the size of the auth tag (16 bytes).
sbEncryptTailTag :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #
NaCl secret_box lazy encrypt with a symmetric 256-bit key and 192-bit nonce with appended auth tag (more efficient with large files).
kcbEncryptTailTag :: KEMHybridSecret -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #
NaCl crypto_box lazy encrypt with with a shared hybrid KEM+DH 256-bit secret and 192-bit nonce with appended auth tag (more efficient with large strings/files).
sbDecryptTailTag :: SbKey -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString) Source #
NaCl secret_box decrypt with a symmetric 256-bit key and 192-bit nonce with appended auth tag (more efficient with large files).
paddedLen should NOT include the tag length, it should be the same number that is passed to sbEncrypt / sbEncryptTailTag.
kcbDecryptTailTag :: KEMHybridSecret -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString) Source #
NaCl crypto_box lazy decrypt with a shared hybrid KEM+DH 256-bit secret and 192-bit nonce with appended auth tag (more efficient with large strings/files).
paddedLen should NOT include the tag length, it should be the same number that is passed to sbEncrypt / sbEncryptTailTag.
sbEncryptTailTagNoPad :: SbKeyNonce -> LazyByteString -> Either CryptoError LazyByteString Source #
sbDecryptTailTagNoPad :: SbKeyNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString) Source #
fastReplicate :: Int64 -> Char -> LazyByteString Source #
secretBox :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError (NonEmpty ByteString) Source #
secretBoxTailTag :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError [ByteString] Source #
cbInit :: DhSecretX25519 -> CbNonce -> Either CryptoError SbState Source #
kcbInit :: KEMHybridSecret -> CbNonce -> Either CryptoError SbState Source #
sbEncryptChunk :: SbState -> ByteString -> (ByteString, SbState) Source #
sbDecryptChunk :: SbState -> ByteString -> (ByteString, SbState) Source #
sbEncryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState) Source #
sbDecryptChunkLazy :: SbState -> LazyByteString -> (LazyByteString, SbState) Source #
type LazyByteString = ByteString Source #