passgen

package module
v0.0.0-...-e541d2e Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

README

image

about

PassGen is a basic secure password generation package and associated cmdline tool. Generated passwords can be of arbitrary length, and conform to a few basic policies.

password policies

  • Alpha - mixed cased roman alphabet passwords

    ex: fdUhcJupKPzOIKBaLfqe
    
  • Numeric - numeric digits in range 0-9

    ex: 92167663796913288031
    
  • AlphaNumeric - combined Alpha and Numeric policies

    ex: Wll77E6bm6TA25agYu60
    
  • Printable - ascii characters in range 33-126 inclusive

    ex: AZn#))q<(m*f42F"+&9-
    
  • Special Characters - any of the basic policies, minus the all inclusive Printable policy -- can be augmented with specifying a string consisting of candidate "special characters". (Note that per your command line shell, you may need to suitably escape the special character string.)

    ex: ]06.8!2[699/][6[61\0 -- given Numeric policy with ".[]!\/" special characters spec.
    
  • No repeated seequences - any of the basic policies can be augmented with specifying a non-reptition of password character sequences. (Note that while some authorized domains specify this behavior, the use of non-repeated flag reduces the space of possible passwords.)

    ex: 14356954843130739693 -- given Numeric policy with no repetition constraint.
    

usage

Refer to the provided example cmdline tool.

License

Copyright 2016 Joubin Houshyar. All rights reserved.

Redistribution and use in source and binary forms, with or without-
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.

   * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation

Overview

package passgen provides a basic secure password generator. The generated passwords are not memorable but are be highly secure.

The generated passwords are of arbitrary length, and conform to a basic set of password policies.

Index

Constants

View Source
const (
	Printable    = "p"  // any printable character in range (33, 126)
	Alpha        = "a"  // mixed case roman alphabet letters
	Numeric      = "n"  // numeric digits in range (0, 9)
	Alphanumeric = "an" // Alpha and Numeric policies combined.
)

password policies

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter [256]bool

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Password generator type

func New

func New(spec Spec) (*Generator, error)

Creates a new Generator with given policy. The provided generator uses the OS provided entropy source /dev/random if parameter 'seedPhrase' is zerovalue (""). If a seedPhrase is provided, then an OS agnostic entropy source is used. The provided seedPhrase must be 8 or more characters in length.

Note that OS based generator must be disposed to close the underlying OS file. See Generator.Dispose()

func (*Generator) Generate

func (p *Generator) Generate(size int) (string, error)

Generates a password of the specified length. An error condition by this method is typically unexpected and should be trated as a system level fault.

type Spec

type Spec struct {
	Policy       string
	SeedPhrase   string // optional - may be zerovalue/""
	SpecialChars string // optional - may be zerovalue/""
	NoRep        bool   // disallow repeated sequences
}

type Spec encapsulates Generator initialization spec.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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