gopass: github.com/justwatchcom/gopass/pkg/hibp/dump Index | Examples | Files

package dump

import "github.com/justwatchcom/gopass/pkg/hibp/dump"

Package dump implements an haveibeenpwned.com dump scanner. It is designed to operate on HIBP SHA-1 dumps which are ordered by hash. It will work with dumps ordered by prevalence, too. But processing those will take much, much longer.

Unfortunately these dumps need to be unpacked before use, since there is no 7z implementation for Go at the time of this writing.

Code:

ctx := context.Background()
scanner, err := New("path/to/hibp-dump")
if err != nil {
    panic(err)
}
matches := scanner.LookupBatch(ctx, []string{
    "list",
    "of",
    "sha1",
    "hashes",
})
fmt.Println(matches)

Index

Examples

Package Files

scanner.go

type Scanner Uses

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

Scanner is a HIBP dump scanner

func New Uses

func New(dumps ...string) (*Scanner, error)

New creates a new scanner. Provide a list of filenames to HIBP SHA-1 dumps. Those should be ordered by hash or lookups will take forever.

func (*Scanner) LookupBatch Uses

func (s *Scanner) LookupBatch(ctx context.Context, in []string) []string

LookupBatch takes a slice SHA1 hashes and matches them against the provided dumps

Package dump imports 12 packages (graph) and is imported by 1 packages. Updated 2021-01-23. Refresh now. Tools for package owners.