md5crypt

package
v0.0.0-...-67a4d09 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 6 Imported by: 7

Documentation

Overview

Package md5crypt provides functions to generate and validate {MD5-CRYPT} styled password schemes. The method used is compatible with libc crypt used in /etc/shadow

Index

Constants

This section is empty.

Variables

View Source
var ErrNotMatching = errors.New("hash does not match password")

ErrNotMatching occurs when the given password and hash do not match

View Source
var ErrNotMd5cryptPassword = errors.New("string is not a MD5-CRYPT password")

ErrNotMd5cryptPassword occurs when Validate receives a non-SSHA hash

View Source
var ErrSaltLengthInCorrect = errors.New("salt length incorrect")

ErrSaltLengthInCorrect occurs when the given salt is not of the correct length

Functions

func Generate

func Generate(password string, length uint8) (string, error)

Generate encrypts a password with a random salt of definable length and returns the {MD5-CRYPT} encoding of the password

func Validate

func Validate(password string, hash string) (bool, error)

Validate compares a given password with a {SSHA} encoded password Returns true is they match or an error otherwise

Types

This section is empty.

Jump to

Keyboard shortcuts

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