ssha

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: 13

Documentation

Overview

Package ssha provides functions to generate and validate {SSHA} styled password schemes. The method used is defined in RFC 2307 and uses a salted SHA1 secure hashing algorithm

Index

Constants

This section is empty.

Variables

View Source
var ErrBase64DecodeFailed = errors.New("base64 decode of hash failed")

ErrBase64DecodeFailed occurs when the given hash cannot be decode

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 ErrNotSshaPassword = errors.New("string is not a SSHA hashed password")

ErrNotSshaPassword occurs when Validate receives a non-SSHA hash

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 {SSHA} 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