Coder Social home page Coder Social logo

lukasmalkmus / diceware Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 44 KB

Go package which provides an implementation of diceware passphrases.

License: MIT License

Go 100.00%
diceware-passphrases diceware diceware-passphrase-generator golang go golang-library

diceware's Introduction

lukasmalkmus/diceware

Diceware passphrases in go. - by Lukas Malkmus

Travis Status Coverage Status Go Report GoDoc Latest Release License


Table of Contents

  1. Introduction
  2. Features
  3. Usage
  4. Contributing
  5. License

Introduction

Package diceware is a simple implementation of the diceware passphrase generation method. Instead of using the normal wordlists, it uses the computer-optimized diceword8k list. Furhtermore it utilizes go's crypto/rand library to generate true random passphrases.

Be advised, that the prefered way of generating diceware passphrases is to do it the old-school way by actually throwing real dices by hand. This is the only 100% secure way.

Features

  • Simple API
  • Only go standard library
  • Passphrases with choosable length
  • Diceware extras for stronger passphrases
  • Verify passphrases

Todo

  • Multiple word lists in multiple languages
  • Read word list from file/buffer (io.Reader)

Usage

Installation

Please use a dependency manager like glide to make sure you use a tagged release.

Install using go get:

go get -u -v github.com/lukasmalkmus/diceware

Creation

Create a passphrase with default values (6 words, no extra):

p, err := diceware.NewPassphrase()
if err != nil {
    // ...
}
fmt.Println(p)

It is also possible to create a passphrase with more or less words. Please note that 6 words is a sensitiv default and less isn't recommended!

p, err := diceware.NewPassphrase(
    diceware.Words(7), // Passphrase with 7 words
)
if err != nil {
    // ...
}
fmt.Println(p)

Note! If you want to use less than 6 words, be sure to set the Validate option to false! Otherwise validation will fail!

Regeneration

All passphrases can be regenerated. This means the options you applied in the NewPassphrase() function are reused for the passphrase generation.

p.Regenerate()
fmt.Println(p)

Tips & Tricks

  • Passphrase implements the Stringer interface thus it can be passed to every function accepting this interface. For example fmt.Println().
  • The String() method isn't very "human friendly". Use the Humanize() method to print the passphrase with whitspace seperated words.
  • Passphrase strength can be improved by adding an extra. Do this by setting the Extra option: Extra(true)

Contributing

Feel free to submit PRs or to fill Issues. Every kind of help is appreciated.

License

© Lukas Malkmus, 2017

Distributed under MIT License (The MIT License).

See LICENSE for more information.

diceware's People

Contributors

lukasma avatar lukasmalkmus avatar

Watchers

 avatar  avatar

diceware's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.