keyfork mnemonic recover
should accept words in a randomized pattern #1
Labels
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: public/keyfork#1
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rationale: Prevent shoulder surfing as well as
keyfork mnemonic generate | keyfork mnemonic recover
, ensuring users write down their mnemonic.cc @lrvick
additional: attacker-known 24 words only provides about 90 bits of entropy, 12 words even less. have the user type in 36 words regardless, which provides 36! permutations which is more than 2^128 / 128 bits of entropy. purpose: keylogger brute forcing based on words tracked.
36 looks nicer than 35, which is the actual smallest number whose permutation count (factorial) is > 2^128
Assumption is that each word is unique but this is only average case, not every case
Since an attacker only needs to select 24 of the 36 words, they can let the remaining 12 words take any order.
You'd be looking for
(X choose 24)*24! > 2^128
, which puts X at 53 for selecting 24 words.However, since the checksum word is determined from the other 23, the attacker really only needs to find 23 words, which puts the required inputs at 59.
Note: This is ignoring duplicate words in the input, and cases where none of the possible checksum words are in the users input. So the actual answer is likely higher.
Figuring out the math for the possibility a 24 word mnemonic has duplicate words, using some rough birthday-problem math (https://en.wikipedia.org/wiki/Birthday_problem#Calculating_the_probability):
12% chance that we have a shared word.
The math says this should be 12%. snail's Python code says this should be 12%. My Rust code - even with OS RNG - says this should be 12%. And yet, for some reason, this test stops at 1%.
https://git.distrust.co/public/keyfork/src/branch/main/keyfork-mnemonic-generate/src/main.rs#L236-L250
Resolved. Vec::dedup only removes sequential duplicates.