Documentation

GaudisCrypt.Lib.EC.BitWord

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.

@[reducible, inline]

word: bit strings of length n.

Equations
Instances For

    mkword s: the word whose i-th bit is nth false s i. s is cut or padded with false to length n.

    Equations
    Instances For
      def GaudisCrypt.EC.BitWord.xorw {n : ℤ} (w₁ w₂ : word n) :

      w₁ +^ w₂: bitwise exclusive or.

      Equations
      Instances For
        theorem GaudisCrypt.EC.BitWord.ofwordK {n : ℤ} (s : List Bool) (h : size s = n) :

        lemma ofwordK s : size s = n => ofword (mkword s) = s.

        theorem GaudisCrypt.EC.BitWord.size_word {n : ℤ} (hn : 0 ≤ n) (w : word n) :
        size (ofword w) = n

        lemma size_word w : size (ofword w) = n (0 ≤ n, EC's gt0_n).

        DWord.dunifin: the uniform distribution on words.

        Equations
        Instances For
          theorem GaudisCrypt.EC.BitWord.dunifin1E {n : ℤ} (x : word n) :
          ↑dunifin {x} = (2 ^ n.toNat)⁻¹

          DWord.dunifin1E: each word has mass 1 / 2 ^ n.

          def GaudisCrypt.EC.BitChunking.chunk {α : Type u_1} (r : ℤ) (bs : List α) :
          List (List α)

          BitChunking.chunk r bs: bs cut into pieces of length r; an incomplete last piece is dropped.

          Equations
          Instances For