leakedpassword

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 6 Imported by: 0

README

Leaked password check

With this library you can check the password is probably leaked or not.

Pre generated bitset DB includes 6 Million leaked passwords stored in bloom filter bitset.

To generate your own bitset DB head into Db-generate and follow instructions.

Bloom filter

The current configuration is a 1 in 1 Million false positive rates. With bloom filter, you can make sure if data is not stored in the bitset. But bloom filter can generate false positives.

To change error rate, you need to generate your own bitset DB. After that you can change bitset DB like this

package main

import (
	"github.com/theykk/leaked-password"
	"os"
	"io"
)

func main() {
	myDB, _ := os.Open("my.db")
	defer myDB.Close()
	leakedpassword.CustomReader = myDB
}

Usage

package main

import (
	"github.com/theykk/leaked-password"
)

func registerUser(username, password string) error {
	// Check password is leaked
	isLeaked, err := leakedpassword.IsLeaked(password)
	if err != nil {
		return err
	}
		
	if isLeaked {
		// Password is leaked do something
	}
	return nil
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomReader io.Reader

CustomReader To support user provided bitset DB

Functions

func IsLeaked added in v1.1.0

func IsLeaked(password string) (bool, error)

IsLeaked is checking password in leaked passwords bitset DB Checking leak status can cause false positives, it depends on your bitset DB

Types

This section is empty.

Jump to

Keyboard shortcuts

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