crypt

package
v0.0.0-...-b60e9d3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("the encoded hash is not in the correct format")
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)

Functions

func CompareBidirectional

func CompareBidirectional(str1, str2 string, compareFunc func(plaintext, hashed string) (bool, error)) (bool, error)

Types

type Algorithm

type Algorithm interface {
	Generator
	BidirectionalComparer
}

type Argon2Comparer

type Argon2Comparer struct{}

func NewArgon2Comparer

func NewArgon2Comparer() (*Argon2Comparer, error)

NewArgon2Comparer returns a new Argon2Comparer.

func (*Argon2Comparer) Compare

func (a *Argon2Comparer) Compare(plaintext, hashed string) (bool, error)

func (*Argon2Comparer) CompareBidirectional

func (a *Argon2Comparer) CompareBidirectional(str1, str2 string) (bool, error)

type Argon2Generator

type Argon2Generator struct {
	// contains filtered or unexported fields
}

func NewArgon2Generator

func NewArgon2Generator(memory uint32, time uint32, threads uint8,
	saltLength uint32, keyLength uint32, saltBase64 string,
) *Argon2Generator

func (*Argon2Generator) Generate

func (a *Argon2Generator) Generate(plaintext string) (string, error)

type BcryptComparer

type BcryptComparer struct{}

func NewBcryptComparer

func NewBcryptComparer() (*BcryptComparer, error)

func (*BcryptComparer) Compare

func (b *BcryptComparer) Compare(plaintext, hashed string) (bool, error)

func (*BcryptComparer) CompareBidirectional

func (b *BcryptComparer) CompareBidirectional(plaintext, hashed string) (bool, error)

type BcryptGenerator

type BcryptGenerator struct {
	// contains filtered or unexported fields
}

func NewBcryptGenerator

func NewBcryptGenerator(cost int) (*BcryptGenerator, error)

func (*BcryptGenerator) Generate

func (b *BcryptGenerator) Generate(plaintext string) (string, error)

type BidirectionalComparer

type BidirectionalComparer interface {
	Comparer
	CompareBidirectional(str1, str2 string) (bool, error)
}

type Comparer

type Comparer interface {
	Compare(plaintext, hashed string) (bool, error)
}

type Generator

type Generator interface {
	Generate(plaintext string) (string, error)
}

Jump to

Keyboard shortcuts

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