diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-10-18 16:52:41 +0200 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-10-25 21:27:38 +0100 |
| commit | 0bb8daa7da52240a971a4ce83d97cfb62971ea78 (patch) | |
| tree | 8e91ebd75f442384f2af4648847c2fdfe919f0b1 /src/crypto/reflibs/Crypto/MAC | |
| parent | e45b366ca8b9caa4fe0087e5c4fb1720472d9c23 (diff) | |
Diffstat (limited to 'src/crypto/reflibs/Crypto/MAC')
| -rw-r--r-- | src/crypto/reflibs/Crypto/MAC/Poly1305.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/crypto/reflibs/Crypto/MAC/Poly1305.hs b/src/crypto/reflibs/Crypto/MAC/Poly1305.hs new file mode 100644 index 0000000..5e8938f --- /dev/null +++ b/src/crypto/reflibs/Crypto/MAC/Poly1305.hs @@ -0,0 +1,20 @@ +module Crypto.MAC.Poly1305 ( + Auth(..), + authTag, +) where + +import Crypto.Error + +import Data.ByteArray as BA +import Data.ByteString (ByteString) + + +newtype Auth = Auth ByteString + deriving (Eq, ByteArrayAccess) + +authTag :: ByteArrayAccess b => b -> CryptoFailable Auth +authTag ba + | BA.length bs /= 16 = CryptoFailed CryptoError + | otherwise = CryptoPassed (Auth bs) + where + bs = convert ba |