cryptipass is a flexible, high-entropy passphrase generator that creates secure, pronounceable passwords using a probabilistic model. It's designed for security-conscious developers who need memorable yet strong passphrases.
- Pronounceable Passwords: Generates words based on real-world token patterns, making them easy to remember.
- Highly Customizable: Define your own word list or use pre-defined patterns like symbols, numbers, and mixed-case letters.
- Secure Randomness: Uses cryptographic-grade randomness (
crypto/rand
) for generating passphrases. - Entropy Analysis: Built-in entropy calculations and certification to ensure high randomness and strength.
- Pattern-Based Generation: Control password structure using customizable patterns (e.g., words, digits, symbols).
To install cryptipass
, use go get
:
go get github.com/francescoalemanno/cryptipass/v3
Then, import it into your project:
import "github.com/francescoalemanno/cryptipass/v3"
NOTE: We also have a CLI available for non-library uses.
Here's how to generate a passphrase using the default word style:
package main
import (
"fmt"
"github.com/francescoalemanno/cryptipass/v3"
)
func main() {
// Create a new cryptipass generator
gen := cryptipass.NewInstance()
// Generate a 4-word passphrase
passphrase, entropy := gen.GenPassphrase(4)
fmt.Println("Passphrase:", passphrase) //e.g. netica.peroundl.opantmene.symnals
fmt.Println("Entropy:", entropy)
}
Want more control over the pattern? Use GenFromPattern
:
// Generate a password with pattern: Word-Number-Symbol
pass, entropy := gen.GenFromPattern("w-d-s") // eg. opantmene-4-%
fmt.Println("Generated Password:", pass)
Possible patterns are formed by combining:
- 'w' lowercase word, 'W' for uppercase word.
- 'c' a lowercase token, 'C' a uppercase token.
- 's' symbol, 'd' digit.
other symbols are interpolated in the final password and to interpolate one of the reserved symbols use escaping with "".
You can customize the word style by creating a new instance from your own token set:
myTokens := []string{"alpha", "bravo", "charlie", "delta"}
gen := cryptipass.NewCustomInstance(myTokens, 1) //instead of 1, try 2,3,4 to see the tradeoff between fidelity to the wordlist and entropy gain.
pass, entropy := gen.GenPassphrase(3)
fmt.Println("Custom Passphrase:", pass) //e.g. alphar.bravo.delta
fmt.Println("Entropy:", entropy)
Full API documentation is available at GoDoc.
cryptipass
is licensed under the MIT License. See LICENSE for details.
Contributions, issues, and feature requests are welcome! Feel free to check out issues or open a pull request.
cryptipass – Secure, flexible, and pronounceable passphrases for your Go applications.