EasyCrypt's fixed-length bit words (theories/datatypes/BitWord.eca) and bit chunking #
(theories/datatypes/BitEncoding.ec, BitChunking)
BitWord is an abstract theory over a length n : int with 0 < n. A clone fixes n and
renames word, typically to block or capacity. Here the theory is the structure word n,
and a clone is a namespace of abbreviations under the new names; see
GaudisCrypt/Examples/SHA3/Common.lean.
mkword s: the word whose i-th bit is nth false s i. s is cut or padded with false to
length n.
Equations
- GaudisCrypt.EC.BitWord.mkword s = List.Vector.ofFn fun (i : Fin n.toNat) => s.getD (↑i) false
Instances For
@[implicit_reducible]
Equations
DWord.dunifin: the uniform distribution on words.
Instances For
w₁ +^ w₂.
Equations
- GaudisCrypt.EC.«term_+^_» = Lean.ParserDescr.trailingNode `GaudisCrypt.EC.«term_+^_» 65 65 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " +^ ") (Lean.ParserDescr.cat `term 66))
Instances For
BitChunking.chunk r bs: bs cut into pieces of length r; an incomplete last piece is
dropped.
Equations
- GaudisCrypt.EC.BitChunking.chunk r bs = GaudisCrypt.EC.mkseq (fun (i : ℤ) => GaudisCrypt.EC.take r (GaudisCrypt.EC.drop (r * i) bs)) (GaudisCrypt.EC.size bs / r)