11 releases (4 breaking)
new 0.9.3 | Feb 21, 2025 |
---|---|
0.9.1 | Feb 19, 2025 |
0.8.3 | Feb 13, 2025 |
0.7.1 | Feb 3, 2025 |
0.3.7 | Jan 18, 2025 |
#445 in Magic Beans
950 downloads per month
365KB
12K
SLoC
Example
let values = vec!['🍔', '🍟', '🌭', '🍦', '🍩'];
let indices = vec![(1, 1), (1, 5), (5, 5), (5, 1), (3, 3)];
let diagram = SimpleDiagram::from_values(&values, &indices);
The simple diagram looks like this:
🍔 | 🍟 | |||||
🍩 | ||||||
🍦 | 🌭 | |||||
Generate mnemonic:
let master = diagram.bip32_master("🚲🍀🌈".as_bytes())?;
let mnemonic = master.bip85_mnemonic(Language::English, 15, 0)?;
lady announce wife please settle connect april hour caution split festival genuine logic digital dignity
Generate wallet private key
let priv_key = master.bip85_wif(0)?;
L25LxS22MwRpEnnFs81XitJyrkimpZGLjgKHRAikLxJoxWMkVuHd
Generate xpriv
let xpriv = master.bip85_xpriv(0)?;
xprv9s21ZrQH143K47Cxw6R8QnGdAru5BaK7kT5awzC9VvmpXnpCQPdEmPyJeR9w3FeJ3hmEBRCRLGhMNpnkcM9q2w3J3T55bSSqMLRDpJLZU4B
Generate password
let pwd = master.bip85_pwd(Password::Emoji, 20, 0)?;
🙏✋🍕🌻🎄🙏👍🔔🔔🍺💊🍄🍺⚡✋👌😍🚗🍎🚗
Entropy Evaluation
mnemonic 12 words entropy = (2048)¹² = (2¹¹)¹² = 2¹³²
mnemonic 24 words entropy = (2048)²⁴ = (2¹¹)²⁴ = 2²⁶⁴
(In fact, because the tail of 4bits/8bits is a checksum, the real entropy is 2¹²⁸/2²⁵⁶.)
Only Emoji Characters
emoji characters amount 1,431 ≈ 2¹⁰
9 cells permutation in 7 * 7 grid = (A₄₉⁹) = 49! / 40! ≈ 2⁴⁹
9 emoji characters in simple diagram = (2¹⁰)⁹ * 2⁴⁹ = 2¹³⁹ > 2¹³²
18 cells permutation in 7 * 7 grid = (A₄₉¹⁸) = 49! / 31! ≈ 2⁹⁵
18 emoji characters in simple diagram = (2¹⁰)¹⁸ * 2⁹⁵ = 2²⁷⁵ > 2²⁶⁴
So, 9 emoji characters provide the equivalent encryption strength of 12 mnemonics.
and 18 emoji characters provide the equivalent encryption strength of 24 mnemonics.
mnemonic words | emoji characters | entropy |
---|---|---|
12 | 9 | 2¹³⁹ |
15 | 11 | 2¹⁷⁰ |
18 | 13 | 2²⁰⁰ |
21 | 16 | 2²⁴⁵ |
24 | 18 | 2²⁷⁵ |
Any Unicode Characters
unicode characters amount 155,063 ≈ 2¹⁷
6 cells permutation in 7 * 7 grid = (A₄₉⁶) = 49! / 43! ≈ 2³³
6 unicode characters in simple diagram = (2¹⁷)⁶ * 2³³ = 2¹³⁵ > 2¹³²
12 cells permutation in 7 * 7 grid = (A₄₉¹²) = 49! / 37! ≈ 2⁶⁵
12 unicode characters in simple diagram = (2¹⁷)¹² * 2⁶⁵ = 2²⁶⁹ > 2²⁶⁴
So, 6 unicode characters provide the equivalent encryption strength of 12 mnemonics.
and 12 unicode characters provide the equivalent encryption strength of 24 mnemonics.
mnemonic words | unicode characters | entropy |
---|---|---|
12 | 6 | 2¹³⁵ |
15 | 8 | 2¹⁸⁰ |
18 | 9 | 2²⁰² |
21 | 11 | 2²⁴⁷ |
24 | 12 | 2²⁶⁹ |
ComplexDiagram can be filled with 50 unicode characters in a cell, providing better encryption strength.
(In fact, higher entropy values are meaningless because the length of the private key is 256 bits.)
Dependencies
~9.5MB
~142K SLoC