ニーモニックの計算方法(BIP-39)

- strength 256 bitの場合

- 256 bit (32 byte)の疑似乱数を生成 (entropy と呼ぶ) (*1)

- entropy のチェックサムを計算(SHA256 の 0 バイト目, 8 bit) (*2)

- それをくっつけて 256 + 8 = 264 bit (33バイト)の整数を生成

- 264 bit の整数は

2^264 = 2^(11*24) = (2^11)^24 = 2048^24

- となり、2048個の単語リストから1単語ずつ選んで24個並べると表現出来る

base64 を知ってる人は base2048 と考えれば簡単。

- base64: データを 6 bit ずつ分割し、それぞれ 64 個 (2^6個) の文字のうち一つを割り当てていく

- base2048: データを 11 bit ずつ分割し、それぞれ 2048 個 (2^11個) の単語のうち一つを割り当てていく

(*1) https://github.com/paulmillr/scure-bip39/blob/2da299230e35dcbfc32b0d30a8df7918fc7c3b21/src/index.ts#L42

(*2) https://github.com/paulmillr/scure-bip39/blob/2da299230e35dcbfc32b0d30a8df7918fc7c3b21/src/index.ts#L50

https://bips.xyz/39

Reply to this note

Please Login to reply.

Discussion

No replies yet.