-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8bbeb31
commit 5c829b0
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# bip39checksum-go | ||
A simple go program to find the last BIP39 mnemonic word | ||
|
||
A simple program written in Go to find the last BIP39 mnemonic word (checksum). | ||
|
||
This program test all possible words and print them. | ||
|
||
|
||
Inspired by: [GitHub - massmux/bip39checksum: BIP39 checksum word finder](https://github.com/massmux/bip39checksum) | ||
|
||
## Dependencies | ||
|
||
`go get github.com/tyler-smith/go-bip39` | ||
|
||
|
||
|
||
## How to run | ||
|
||
### Run the program yourself | ||
|
||
`go run bip39checksum.go` | ||
|
||
### Use the compiled binary (Linux) | ||
|
||
1. `chmod +x bip39checksum.go` | ||
|
||
2. ./bip39checksum | ||
|
||
|
||
|
||
## Disclamer | ||
|
||
This program is provided "as is", I am not responsible for any loss of funds caused by the use of this program. | ||
It is strongly recommended to use it on an offline computer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"github.com/tyler-smith/go-bip39" | ||
"os" | ||
) | ||
|
||
// 23 words for testing | ||
// loud omit domain valve topic engine velvet chat foil few wrap unable practice snap gift version brass board broom loud amateur cabin toss | ||
|
||
func main() { | ||
reader := bufio.NewReader(os.Stdin) | ||
|
||
fmt.Print("Please insert your mnemonic phrase: ") | ||
input, _ := reader.ReadString('\n') | ||
words := brute(input) | ||
n := len(words) | ||
|
||
if n > 0 { | ||
fmt.Println("\nPossible last words for this mnemonic: ") | ||
PrintWords(words) | ||
} else { | ||
fmt.Println("Mnemonic invalid") | ||
} | ||
|
||
} | ||
|
||
func brute(mnemonic string) []string { | ||
english := bip39.GetWordList() | ||
var valid_words []string | ||
|
||
for _, word := range english { | ||
current := mnemonic + " " + word | ||
valid := bip39.IsMnemonicValid(current) | ||
|
||
if valid { | ||
valid_words = append(valid_words, word) | ||
} | ||
} | ||
return valid_words | ||
} | ||
|
||
func PrintWords(arr []string) { | ||
for _, w := range arr { | ||
fmt.Printf("- %s\n", w) | ||
} | ||
|
||
} |