okpaaswoad

package module
v0.0.0-...-4526e35 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: ISC Imports: 1 Imported by: 0

README

Okpaaswoad generates random, humane passwords.

Author : Adrian Ratnapala

Get Source : git clone https://git.sr.ht/~ibba/okpaaswoad

Copyright (C) 2020, Adrian Ratnapala, under the ISC license. See file LICENSE.

Okpaaswoad is a small tool and Go library (module) for generating strong random passwords, such as:

vihaleqaco
ryompuibyv
ubqasojywi
ocyftoaqfu

Passwords like these are secure in the sense that they encode 40 bits of entropy. But they are easier to handle than most random passwords because:

  • They can be a spoken out loud, which is an aid to memory.
  • Being reasonably short, and all lower-case, they are easy to type.

The Tool

Go users can install the okpw tool with

go get git.sr.ht/~ibba/okpaaswoad/okpw
go install git.sr.ht/~ibba/okpaaswoad/okpw

Then you can just run it to write random passwords to standard output.

$ okpw
fozykucuac

By default okpw gets entropy from the crypto/rand Go package. You can choose any other source with the -entropy flag:

okpw -entropy=filename-of-entropy-source

And - means standard input. Thus:

okpw -entropy=- < /dev/urandom

and:

okpw -entropy=/dev/urandom

do the same thing.

The Library

Install it with

go get git.sr.ht/~ibba/okpaaswoad

You can then generate passwords with

pw, err := okpaaswoad.ReadAndEncode(rand.Reader, bytesOfEntropy)

See also doc/example.go and refer to the package documentation for further details.

go doc git.sr.ht/~ibba/okpaaswoad

Documentation

Overview

Package okpaaswoad generates random, humane passwords (okpaaswoads) by encoding bits of entropy into pairs of lower-case English letters called digraphs. These are chosen so that the resulting passwords can be pronounced out loud. Okpaaswoads are secure in the sense that they reversibly encode all the bits of entropy.

API

Function Encode() encodes bytes and returns an okpaaswoad as a string. It can't return an error. Function ReadAndEncode() encodes a given number of bytes from an io.Reader that provides entropy, for example:

pw, err := okpaaswoard.ReadAndEncode(rand.Reader, bytesOfEntropy)

There is no default entropy source, most users should use package "crypto/rand".

Function Digraph() encodes a single byte into a pair of letters. There is no facility for decoding okpaaswoads or digraphs into bytes -- users who want this can use Digraph() to build a 26x26 lookup table.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digraph

func Digraph(b byte) (byte, byte)

Digraph reversibly encodes a byte b into two lower-case English letters. When used for passwords, b should be random bits from a good source such as the crypto/rand package.

func Encode

func Encode(b []byte) string

Encode encodes a byte array into password letters using Digraph(). b should be random bits from some entropy source such as the crypto/rand package.

func ReadAndEncode

func ReadAndEncode(r io.Reader, n int) (string, error)

Encode encodes bytes from an io.Reader into password letters using Digraph(). r should be a source of random bits like Reader from package crypto/rand.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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