• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
          • Mmp-trees
          • Semaphore
            • Verify-semaphore-r1cs
            • Mimc
            • Semaphore-specification
              • Prime-field-abbreviations
              • Pedersen-hash
                • Pedersen-scalar
                • Pedersen-generator
                • Pedersen-enc
                • Pedersen-pad
                  • Pedersen
                  • Pedersen-addend
                • Pedersen-hash-base-points
                • Baby-jubjub
              • Semaphore-proofs
            • Database
            • Cryptography
            • Rlp
            • Transactions
            • Hex-prefix
            • Basics
            • Addresses
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Pedersen-hash

    Pedersen-pad

    Pedersen hash padding.

    Signature
    (pedersen-pad m) → m1
    Arguments
    m — Guard (bit-listp m).
    Returns
    m1 — Type (bit-listp m1), given (bit-listp m).

    [IS] says that if the input message is not a multiple of 4 bits, it is padded with 1, 2, or 3 bits to turn it into a multiple of 4 bits. [ES] does not say anything about it, but it talks about 4-bit windows, thus perhaps leaving the padding implicit. [IS] says that the zero bits are appended, which suggests that they are added at the end.

    Definitions and Theorems

    Function: pedersen-pad

    (defun pedersen-pad (m)
      (declare (xargs :guard (bit-listp m)))
      (let ((acl2::__function__ 'pedersen-pad))
        (declare (ignorable acl2::__function__))
        (case (mod (len m) 4)
          (0 m)
          (1 (append m (list 0 0 0)))
          (2 (append m (list 0 0)))
          (3 (append m (list 0)))
          (otherwise (acl2::impossible)))))

    Theorem: bit-listp-of-pedersen-pad

    (defthm bit-listp-of-pedersen-pad
      (implies (bit-listp m)
               (b* ((m1 (pedersen-pad m)))
                 (bit-listp m1)))
      :rule-classes :rewrite)

    Theorem: len-of-pedersen-pad

    (defthm len-of-pedersen-pad
      (b* ((?m1 (pedersen-pad m)))
        (equal (len m1)
               (* 4 (ceiling (len m) 4)))))

    Theorem: multiple-of-4-len-of-pedersen-hash

    (defthm multiple-of-4-len-of-pedersen-hash
      (b* ((?m1 (pedersen-pad m)))
        (integerp (/ (len m1) 4))))