• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
        • Bitcoin
          • Bip32
          • Bech32
          • Bip39
            • *bip39-english-words*
            • Bip39-mnemonic-to-seed
            • Bip39-entropy-to-word-indexes
            • Bip39-entropy
            • Bip39-word-indexes-to-words
            • Bip39-words-to-mnemonic
            • Bip39-entropy-to-seed
              • Bip39-entropy-to-mnemonic
              • Bip39-english-words-bound-p
              • Bip39-entropy-size-p
            • Bip44
            • Base58
            • Bip43
            • Bytes
            • Base58check
            • Cryptography
            • Bip-350
            • Bip-173
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Bip39

    Bip39-entropy-to-seed

    Turn an entropy value into a seed.

    Signature
    (bip39-entropy-to-seed entropy passphrase) → seed
    Arguments
    entropy — Guard (bip39-entropyp entropy).
    passphrase — Guard (stringp passphrase).
    Returns
    seed — Type (byte-listp seed).

    This combines bip39-entropy-to-mnemonic and bip39-mnemonic-to-seed.

    The limit on the passphrase is the same as in bip39-mnemonic-to-seed. The mnemonic is always below the limit in bip39-mnemonic-to-seed: see the upper bound theorem for bip39-entropy-to-mnemonic.

    Definitions and Theorems

    Function: bip39-entropy-to-seed

    (defun bip39-entropy-to-seed (entropy passphrase)
      (declare (xargs :guard (and (bip39-entropyp entropy)
                                  (stringp passphrase))))
      (declare (xargs :guard (< (length passphrase)
                                (- (expt 2 125) (+ 128 4 8)))))
      (b* ((mnemonic (bip39-entropy-to-mnemonic entropy))
           (seed (bip39-mnemonic-to-seed mnemonic passphrase)))
        seed))

    Theorem: byte-listp-of-bip39-entropy-to-seed

    (defthm byte-listp-of-bip39-entropy-to-seed
      (b* ((seed (bip39-entropy-to-seed entropy passphrase)))
        (byte-listp seed))
      :rule-classes :rewrite)

    Theorem: len-of-bip39-entropy-to-seed

    (defthm len-of-bip39-entropy-to-seed
      (equal (len (bip39-entropy-to-seed entropy passphrase))
             64))

    Theorem: bip39-entropy-to-seed-of-bip39-entropy-fix-entropy

    (defthm bip39-entropy-to-seed-of-bip39-entropy-fix-entropy
      (equal (bip39-entropy-to-seed (bip39-entropy-fix entropy)
                                    passphrase)
             (bip39-entropy-to-seed entropy passphrase)))

    Theorem: bip39-entropy-to-seed-bip39-entropy-equiv-congruence-on-entropy

    (defthm
        bip39-entropy-to-seed-bip39-entropy-equiv-congruence-on-entropy
      (implies (bip39-entropy-equiv entropy entropy-equiv)
               (equal (bip39-entropy-to-seed entropy passphrase)
                      (bip39-entropy-to-seed entropy-equiv passphrase)))
      :rule-classes :congruence)

    Theorem: bip39-entropy-to-seed-of-str-fix-passphrase

    (defthm bip39-entropy-to-seed-of-str-fix-passphrase
      (equal (bip39-entropy-to-seed entropy (acl2::str-fix passphrase))
             (bip39-entropy-to-seed entropy passphrase)))

    Theorem: bip39-entropy-to-seed-streqv-congruence-on-passphrase

    (defthm bip39-entropy-to-seed-streqv-congruence-on-passphrase
      (implies (acl2::streqv passphrase passphrase-equiv)
               (equal (bip39-entropy-to-seed entropy passphrase)
                      (bip39-entropy-to-seed entropy passphrase-equiv)))
      :rule-classes :congruence)