-
@ kohanucha
2024-01-04 15:04:15การสร้าง 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
คือ 2048hash-function
คือ HMAC-SHA512derived-key-len
คือ 512 bits หรือ 64 bytes
ค่า binary ที่ได้ออกมาจาก function จะมีความยาวตาม
derived-key-len
ก็คือ 512 bits ซึ่งสามารถนำค่านี้ไปสร้าง deterministic wallets ตาม BIP-32 ได้