poly1305

The Poly1305 message authentication code (docs.ppad.tech/poly1305).
git clone git://git.ppad.tech/poly1305.git
Log | Files | Refs | README | LICENSE

commit a54bf8752fca63fff2d945776f9460f3a9b8a878
parent 39086a34e39ee4545f74011dd550b47bf2f49bda
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 26 Apr 2026 03:31:06 -0230

bench: add weigh suite

Diffstat:
Abench/Weight.hs | 25+++++++++++++++++++++++++
Mppad-poly1305.cabal | 17+++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/bench/Weight.hs b/bench/Weight.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import qualified Crypto.MAC.Poly1305 as Poly1305 +import qualified Data.ByteString as BS +import Weigh + +-- note that 'weigh' doesn't work properly in a repl +main :: IO () +main = mainWith mac + +mac :: Weigh () +mac = + let !key = BS.replicate 32 0x88 + !bs0 = BS.replicate 16 0 + !bs1 = BS.replicate 64 0 + !bs2 = BS.replicate 128 0 + !bs3 = BS.replicate 1024 0 + in wgroup "mac" $ do + func "mac (16B input)" (Poly1305.mac key) bs0 + func "mac (64B input)" (Poly1305.mac key) bs1 + func "mac (128B input)" (Poly1305.mac key) bs2 + func "mac (1024B input)" (Poly1305.mac key) bs3 diff --git a/ppad-poly1305.cabal b/ppad-poly1305.cabal @@ -71,3 +71,20 @@ benchmark poly1305-bench , ppad-base16 , ppad-poly1305 +benchmark poly1305-weigh + type: exitcode-stdio-1.0 + default-language: Haskell2010 + hs-source-dirs: bench + main-is: Weight.hs + + ghc-options: + -rtsopts -O2 -Wall + if flag(llvm) + ghc-options: -fllvm + + build-depends: + base + , bytestring + , ppad-poly1305 + , weigh +