summaryrefslogtreecommitdiff
path: root/src/crypto/reflibs/Crypto/Cipher
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-11-08 15:08:02 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-11-08 20:41:24 +0100
commitaefa4b4dc76c3feaab223ff7afe1293c7434fae0 (patch)
tree65106a4d4c3443e7a057082f8cb768c2400d3be4 /src/crypto/reflibs/Crypto/Cipher
parent4a83167a5199ad078b14b0df7a2ac1ef0b4f58b6 (diff)
Use ByteString in nonce-related functions
Diffstat (limited to 'src/crypto/reflibs/Crypto/Cipher')
-rw-r--r--src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs b/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
index c849c0b..7f0ef20 100644
--- a/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
+++ b/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
@@ -27,16 +27,16 @@ data AeadState = AeadState
newtype Nonce = Nonce ByteString
deriving (Eq, ByteArrayAccess)
-nonce8 :: Bytes -> Bytes -> CryptoFailable Nonce
+nonce8 :: ByteString -> ByteString -> CryptoFailable Nonce
nonce8 c iv
- | BA.length c /= 4 = CryptoFailed CryptoError
- | BA.length iv /= 8 = CryptoFailed CryptoError
- | otherwise = CryptoPassed $ Nonce $ B.concat $ [ BA.convert c, BA.convert iv ]
+ | B.length c /= 4 = CryptoFailed CryptoError
+ | B.length iv /= 8 = CryptoFailed CryptoError
+ | otherwise = CryptoPassed $ Nonce $ B.concat [ c, iv ]
-nonce12 :: Bytes -> CryptoFailable Nonce
+nonce12 :: ByteString -> CryptoFailable Nonce
nonce12 iv
- | BA.length iv /= 12 = CryptoFailed CryptoError
- | otherwise = CryptoPassed $ Nonce $ BA.convert iv
+ | B.length iv /= 12 = CryptoFailed CryptoError
+ | otherwise = CryptoPassed $ Nonce iv
aeadInitialize :: ScrubbedBytes -> Nonce -> CryptoFailable AeadState
aeadInitialize key nonce