Bitcoin

hash – What is the PBKDF2 implementation in Bitcoin?

I’m trying to understand how Bitcoin works by writing code myself in C++. I’m currently having trouble implementing the PBKDF2 functionality correctly. I have tried various sources of information such as:

  1. Golang’s PBKDF2
  2. NIST page 7
  3. Ian’s fantastic tool
  4. another tool
  5. great guide

And many others. Some of them are code sources, some are just for checking the calculation results.

At 5. I understand that the SALT parameter in PBKDF2 must be a “mnemonic” string. According to 1 and 2, we need to concatenate SALT with the 4-byte representation of the integer 1 (Bitcoin doesn’t need 2, 3, …). Is it true? For the simplest SALT input, should I concatenate SALT with “0001”, or is a “mnemonic” enough??? What is the correct padding for mnemonic sentence strings? Should I keep spaces between words? From what I already know, HMAC-SHA512 message padding starts with SALT (a 128-byte block) followed by a mnemonic statement. I believe I’ve tried every combination of parameters and computational approaches (I’m desperate :)). And I also believe there is some kind of trick. So far I’ve seen tricks in almost everything called explicit algorithms.

help.

Related Articles

Back to top button