md5

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package md5 provides hashing and verification or md5Crypt encoded passwords. Note that md5 is considered cryptographically broken and should not be used for new applications. This package is only provided for legacy applications that wish to migrate away from md5 to newer hashing methods.

Index

Constants

View Source
const (
	Identifier = "1"
	Prefix     = "$" + Identifier + "$"

	// Format of the Modular Crypt Format, as used by passlib.
	// See https://passlib.readthedocs.io/en/stable/lib/passlib.hash.md5_crypt.html#format
	Format = Prefix + "%s$%s"

	// Encoding is the character set used for encoding salt and checksum.
	Encoding = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)

Variables

Verifier for md5.

Functions

func Verify

func Verify(encoded, password string) (verifier.Result, error)

Verify parses encoded and verfies password against the checksum.

Types

type Hasher

type Hasher struct{}

Hasher provides an md5 hasher which always obtains a salt of 6 random bytes, resulting in 8 encoded characters. md5 is considered crypgraphically broken and this hasher should not be used in new applications. It is only provided for legacy applications that really depend on md5.

func (Hasher) Hash

func (Hasher) Hash(password string) (string, error)

Hash implements passwap.Hasher.

func (Hasher) Verify

func (Hasher) Verify(encoded, password string) (verifier.Result, error)

Verify implements passwap.Verifier

Jump to

Keyboard shortcuts

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