pin

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength = errors.New("pin length must be greater than 0")
)

Functions

func CompareAlphanumeric

func CompareAlphanumeric(pin1, pin2 string) bool

CompareAlphanumeric performs a constant-time, case-insensitive comparison of two alphanumeric PINs. Dashes are stripped before comparison, so "ABC-123" matches "abc123". Returns true if they match, false otherwise.

func CompareNumeric

func CompareNumeric(pin1, pin2 string) bool

CompareNumeric performs a constant-time comparison of two numeric PINs. Dashes are stripped before comparison, so "123-456" matches "123456". Returns true if they match, false otherwise.

func GenerateAlphanumeric

func GenerateAlphanumeric(length int) (string, error)

GenerateAlphanumeric generates a cryptographically secure alphanumeric PIN of the specified length. The generated PIN contains uppercase letters and digits.

func GenerateNumeric

func GenerateNumeric(length int) (string, error)

GenerateNumeric generates a cryptographically secure numeric PIN of the specified length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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