Documentation ¶
Overview ¶
* Code for generating a printable wallet-sized card containing random password characters.
Index ¶
Constants ¶
const SeedLength = 32
The number of characters in a seed (after removing dashes and spaces)
Variables ¶
This section is empty.
Functions ¶
func CreateRandomSeed ¶
*Generate a new seed from a secure-random source (crypto/rand). The seed has slightly more than 128bits of entropy. It is encoded as 32 A-Z characters. The last two characters are a checksum. Having only A-Z characters makes it easier for users to input their seed (especially on a mobile device). The seed is formatted for easy reading as 8 groups of 4, separated by dashes like so:
ATXK-XGFG-TSPF-JSCG-KEMD-YTBJ-ZWEB-LDVW
The A-Z encoding is one-way. To convert the seed to bytes, hash it with sha256 (uppercase, without the dashes).
This operation should only be done on a trusted computer.
func DigestSeed ¶
* Convert the human readable seed, like "ATXK-XGFG-TSPF-JSCG-KEMD-YTBJ-ZWEB-LDVW", to bytes. Returns an error if the seed is malformed or corrupt. The seed is not case sensitive and dashes and spaces are ignored.
Types ¶
type Coord ¶
type Coord struct { //Horizontal coordinate index, starting at 0 X int //Vertical coordinate index, starting at 0 Y int //The human friendly representation (eg "13W"). HumanX string HumanY string }
*A coordinate on the card
func MakeCoordinates ¶
func MakeCoordinates(key []byte, count, cardSizeX, cardSizeY int, xNameFunc, yNameFunc CoordinateNameFunc) ([]Coord, error)
*Given the 32 byte secret key, deterministically generate `count` X,Y coordinates in the range [0,cardSizeX), [0,cardSizeY). The human friendly names for the coordinates are produced by xNameFunc and yNameFunc