Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alex27riva committed May 27, 2021
1 parent 8bbeb31 commit 5c829b0
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
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.
50 changes: 50 additions & 0 deletions bip39checksum.go
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)
}

}

0 comments on commit 5c829b0

Please sign in to comment.