จาก Seed Phrase สู่ Binary Seed

จาก Seed Phrase สู่ Binary Seed

การสร้าง Seed จาก Seed Phrase

ในการสร้าง Binary Seed นั้นจะใช้ function ชื่อว่า PBKDF2 ซึ่งหน้าตาจะเป็นแบบนี้

pbkdf2(password, salt, iterations-count, hash-function, derived-key-len)

แต่ละ parameters จะแทนค่าตามนี้

  • password คือ mnemonic sentence หรือ seed phrase (encoded in UTF-8) ยกตัวอย่างเช่น craneprofitfanholdpictureboardsoccermangodanceclipnephewplug
  • salt คือ คำว่า “mnemonic” + passphrase (encoded in UTF-8) หรือ ถ้าไม่มี passphrase ก็จะเป็นแค่คำว่า “mnemonic” คำเดียว ยกตัวอย่างเช่น กรณีมี passphrase ก็คือ mnemonichelloworld หรือ กรณีไม่มี passphrase ก็คือ mnemonic
  • iterations-count คือ 2048
  • hash-function คือ HMAC-SHA512
  • derived-key-len คือ 512 bits หรือ 64 bytes

ค่า binary ที่ได้ออกมาจาก function จะมีความยาวตาม derived-key-len ก็คือ 512 bits ซึ่งสามารถนำค่านี้ไปสร้าง deterministic wallets ตาม BIP-32 ได้


Write a comment
No comments yet.