hashers

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHashMismatch = errors.New("hash mismatch")
View Source
var PBKDF2Pattern = regexp.MustCompile(`^\$pbkdf2-sha512\$20000\$\$[A-Za-z0-9./]{86}$`)

PBKDF2Pattern matches the one string Doorkeeper's Pbkdf2Sha512 strategy stored for refresh tokens from 2022-09 and application secrets from 2023-01, until the sha512_oauth rollout in 2025-09: 20000 rounds, an empty salt, and the 64-byte digest as 86 passlib base64 chars ('.' for '+', no padding). gitlab-rails never wrote another shape (gitlab-org/gitlab#632068, note 4068971162).

View Source
var SHA512HexPattern = regexp.MustCompile(`^[0-9a-f]{128}$`)

SHA512HexPattern matches a SHA-512 digest as 128 lowercase hex characters, the form Doorkeeper stores (Digest::SHA512.hexdigest). A Doorkeeper plaintext is 64 hex chars (SecureRandom.hex(32)), so an accidentally-sent plaintext fails the match instead of being stored as a digest.

Functions

This section is empty.

Types

type SHA512

type SHA512 struct{}

func (*SHA512) Compare

func (h *SHA512) Compare(ctx context.Context, hash, data []byte) error

func (*SHA512) Hash

func (h *SHA512) Hash(_ context.Context, data []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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