blocklist

package
v1.0.0-dev.19 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package blocklist holds the embedded list of common passwords access refuses, generated from SecLists by "go generate ./internal/blocklist", and the fold the password-context and common-password checks share.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(password string) bool

Contains reports whether password, folded, is on the embedded list.

func Encode

func Encode(h *Header, entries []string) []byte

Encode renders h, with Kept and BodySHA256 taken from entries, a blank line, then one entry per line. Every entry must be non-empty and hold no newline, or Decode refuses the result.

func Fold

func Fold(s string) string

Fold returns s in the form the list holds and the password-context and common-password checks compare: NFC, then full Unicode case folding.

func ReadCommit

func ReadCommit(path string) (string, error)

ReadCommit returns the SecLists commit the header of the list file at path records, refusing a file Decode refuses and a commit that is not 40 lowercase hex characters.

Types

type Header struct {
	URL           string // the source file at Commit
	Commit        string
	SourceSHA256  string
	BodySHA256    string // of every byte after the header's blank line
	MinRunes      int    // the shortest entry kept, in runes after Fold
	SourceEntries int    // non-empty lines in the source
	Survivors     int    // distinct folded entries of at least MinRunes
	Kept          int    // the first Survivors in the source's order, capped
}

Header is common.txt's provenance.

func Decode

func Decode(data string) (Header, []string, error)

Decode parses Encode's output. It refuses a malformed header or one missing a field, a body whose hash or entry count differs from the header, an empty body or entry, and a body without its final newline.

Jump to

Keyboard shortcuts

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