bip39

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Overview

package bip39 represents and converts bitcoin bip39 mnemonic phrases.

Index

Constants

View Source
const LongestWord = 8
View Source
const NumWords = Word(len(index))
View Source
const ShortestWord = 3

Variables

View Source
var ErrInvalidChecksum = errors.New("bip39: invalid checksum")

Functions

func Checksum

func Checksum(entropy []byte) byte

func LabelFor

func LabelFor(w Word) string

func MnemonicSeed

func MnemonicSeed(m Mnemonic, password string) []byte

Types

type Mnemonic

type Mnemonic []Word

func ParseMnemonic

func ParseMnemonic(mnemonic string) (Mnemonic, error)

func (Mnemonic) Entropy

func (m Mnemonic) Entropy() []byte

Entropy returns the entropy represented by the mnemonic. It panics if the mnemonic is invalid.

func (Mnemonic) FixChecksum

func (m Mnemonic) FixChecksum() Mnemonic

FixChecksum returns a copy of the mnemonic with a correct checksum. This method defeats the purpose of the bip39 checksum, so it should only be used for generating new mnemonics.

func (Mnemonic) Valid

func (m Mnemonic) Valid() bool

Valid reports whether the mnemonic checksum is correct.

type Roll

type Roll [5]int

type Word

type Word int

func ChecksumWord

func ChecksumWord(entropy []byte) Word

func ClosestWord

func ClosestWord(word string) (Word, bool)

func DiceToWord

func DiceToWord(roll Roll) (Word, bool)

DiceToWord converts a dice roll to its bip39 word index. It returns false if the roll doesn't have a word defined.

func RandomWord

func RandomWord() Word

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL