diff --git a/src/Challenge/Pure.hs b/src/Challenge/Pure.hs index cccb405..36694ff 100644 --- a/src/Challenge/Pure.hs +++ b/src/Challenge/Pure.hs @@ -1,5 +1,5 @@ --- | Fiat-Shamir challenges +-- | Duplex sponge used for Fiat-Shamir challenges {-# LANGUAGE StrictData, GeneralizedNewtypeDeriving #-} module Challenge.Pure diff --git a/src/Hash/Constants.hs b/src/Hash/Constants.hs index 5eab5ec..dcebd64 100644 --- a/src/Hash/Constants.hs +++ b/src/Hash/Constants.hs @@ -1,5 +1,5 @@ --- | Constant's for Plonky2's version of Poseidon hash +-- | Constants for Plonky2's version of Poseidon hash -- -- See @@ -40,6 +40,8 @@ fast_PARTIAL_ROUND_CONSTANTS = listArray (0,21) , 0x1aca78f31c97c876 , 0x0 ] +{- + fast_PARTIAL_ROUND_VS :: [Array Int F] fast_PARTIAL_ROUND_VS = map (listArray (0,10)) [ [0x94877900674181c3, 0xc6c67cc37a2a2bbd, 0xd667c2055387940f, 0x0ba63a63e94b5ff0, 0x99460cc41b8f079f, 0x7ff02375ed524bb3, 0xea0870b47a8caf0e, 0xabcad82633b7bc9d, 0x3b8d135261052241, 0xfb4515f5e5b0d539, 0x3ee8011c2b37f77c ] @@ -92,6 +94,7 @@ fast_PARTIAL_ROUND_W_HATS = map (listArray (0,10)) , [0x3abeb80def61cc85, 0x9d19c9dd4eac4133, 0x075a652d9641a985, 0x9daf69ae1b67e667, 0x364f71da77920a18, 0x50bd769f745c95b1, 0xf223d1180dbbf3fc, 0x2f885e584e04aa99, 0xb69a0fa70aea684a, 0x09584acaa6e062a0, 0x0bc051640145b19b ] ] +-} -- ^ NB: This is in ROW-major order to support cache-friendly pre-multiplication. fast_PARTIAL_ROUND_INITIAL_MATRIX :: Array (Int,Int) F diff --git a/src/Hash/Digest.hs b/src/Hash/Digest.hs index 578d784..0890a3b 100644 --- a/src/Hash/Digest.hs +++ b/src/Hash/Digest.hs @@ -1,4 +1,6 @@ +-- | Hash digests consist of 4 goldilocks field elements + {-# LANGUAGE DeriveGeneric, OverloadedStrings #-} module Hash.Digest where diff --git a/src/Hash/Poseidon.hs b/src/Hash/Poseidon.hs index fef1d32..34ff797 100644 --- a/src/Hash/Poseidon.hs +++ b/src/Hash/Poseidon.hs @@ -20,7 +20,10 @@ import Hash.Digest -------------------------------------------------------------------------------- --- | permutation of @[0..11]@ +-- | KAT = Known Answer Test +-- +-- This is the permutation of @[0..11]@ +-- kats :: [Word64] kats = [ 0xd64e1e3efc5b8e9e , 0x53666633020aaa47 , 0xd40285597c6a8825 , 0x613a4f81e81231d2 diff --git a/src/Hash/Sponge.hs b/src/Hash/Sponge.hs index 80caf4d..abc44a7 100644 --- a/src/Hash/Sponge.hs +++ b/src/Hash/Sponge.hs @@ -1,4 +1,6 @@ +-- | Sponge construction + module Hash.Sponge where --------------------------------------------------------------------------------