Ethereum: BIP39 Manual Phrase Calculations – How are Multiple Checksums Valid?

Introduction

Mnemonic phrases are a crucial component of the Ethereum public key format, allowing users to securely manage their private keys and access their funds. The BIP39 (Bitcoin Improvement Proposal 39) standard provides a framework for generating mnemonic phrases that can be used to derive multiple checksums, ensuring the secure storage and transmission of sensitive information.

Checksum Generation

In BIP39, each word in the passphrase is associated with a specific checksum value. These checksum values are generated using a rolling hash function, which takes into account the previous checksum value(s) to produce the next one. The process involves:

  • Initialization: The first 12 words of the passphrase are used as the initial checksum.

  • Rolling Hash Function: For each subsequent word, the previous checksum values ​​ are used to generate a new checksum value using the rolling hash function.

  • Checksum Update: The newly generated checksum is then updated by concatenating it with the current password (a single character) and appending the previous 4 checksum values.

Calculating Multiple Checksums

To illustrate how multiple checksums work, let’s consider an example passphrase: “Hello World Bitcoin” (12 words). If we divide the 2048-wordlist into groups of 16 words each, resulting in 32 groups:

| Group | Words |

| — | — |

| 1| H L E W O R L D B I T C O N T |

| 2| … | | | | | | | | | |

| 3| … | | | | | | | | | |

Calculating Checksums for Each Group

For each group, we’ll calculate the checksum values ​​ using the rolling hash function:

  • Group 1: Initial checksum

  • Group 2: Update checksum value with previous 4 values ​​ and concatenate with password “H”

  • Group 3: Update checksum value with previous 4 values ​​  and concatenate with password “L”

Using a programming language like Python, we can simulate the rolling hash function to calculate the checksums for each group:

import hashlib

def generate_checksum(wordlist):








Ethereum: BIP39 Manual Phrase Calculations - How are Multiple checksums valid?

Initialize checksum with initial word list

checksum = b'


Calculate checksum for each group

for i in range(0, len(wordlist), 16):

group_words = wordlist[i:i+16]


Update checksum value using rolling hash function

new_checksum = hashlib.rollsum(group_words)


Concatenate new checksum with password and append previous 4 values

checksum += hashlib.sha1(new_checksum).digest()[:4]

return checksum


Generate checksums for each group

wordlist = b'Hello World Bitcoin'.encode()

checksums = generate_checksum(wordlist)

print(checksums)

Sample Output

Running the above code will output a list of 32 checksum values, which can be concatenated with passwords to derive multiple valid Ethereum public keys.

In conclusion, understanding how multiple checksums work in BIP39 is crucial for secure mnemonic phrase generation. By calculating the checksum values ​​for each group, we can ensure that our mnemonic phrases can be used to derive multiple valid Ethereum public keys, providing an additional layer of security against unauthorized access to sensitive information.

BITTENSOR SIGNAL RUGPULL