crypto

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptHash added in v1.4.0

func BcryptHash(password string, cost int) (string, error)

func GetRandBytes

func GetRandBytes(n int) ([]byte, error)

func HashSHA1

func HashSHA1(input string) []byte

func HashSHA256

func HashSHA256(input string) []byte

func HashSHA384

func HashSHA384(input string) []byte

func HashSHA512

func HashSHA512(input string) []byte

func HmacSHA1

func HmacSHA1(input string, base64urlKey string) ([]byte, error)

func HmacSHA256

func HmacSHA256(input string, base64urlKey string) ([]byte, error)

func HmacSHA384

func HmacSHA384(input string, base64urlKey string) ([]byte, error)

func HmacSHA512

func HmacSHA512(input string, base64urlKey string) ([]byte, error)

func IsBcryptHash added in v1.4.0

func IsBcryptHash(hash string) bool

func IsPbkdf2Hash added in v1.4.0

func IsPbkdf2Hash(hash string) bool

func NewUUID

func NewUUID() string

func Pbkdf2Hash added in v1.4.0

func Pbkdf2Hash(data *Pbkdf2) (string, error)

func VerifyBcryptHash added in v1.4.0

func VerifyBcryptHash(password, hash string) bool

func VerifyPbkdf2Hash added in v1.4.0

func VerifyPbkdf2Hash(password string, hashStored string) bool

Types

type ALG_SHA added in v1.4.0

type ALG_SHA string
const (
	SHA256 ALG_SHA = "sha256"
	SHA384 ALG_SHA = "sha384"
	SHA512 ALG_SHA = "sha512"
)

type Pbkdf2 added in v1.4.0

type Pbkdf2 struct {
	Password   string  `json:"password"`
	Iterations int     `json:"iterations"`
	SaltSize   int     `json:"salt_size"`
	KeyLen     int     `json:"key_len"`
	Alg        ALG_SHA `json:"alg"`
}

Jump to

Keyboard shortcuts

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