crypt

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HASHED_PASSWORD_FORMAT = "$argon2id$v=%d$m=%d,t=%d,p=%d$%s$%s"
	ArgonSaltLength        = 16
	ArgonKeyLength         = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptService

type CryptService interface {
	// Hash is a function to hash data using sha256
	Hash(data string) string

	// Base64Encode is a function to encode data using base64
	Base64Encode(data string) string

	// Base64Decode is a function to decode data using base64
	Base64Decode(data string) (string, error)

	// Decrypt is a function to decrypt data using aes256-gcm
	Decrypt(key string, data string) (string, error)

	// Encrypt is a function to encrypt data using aes256-gcm
	Encrypt(key string, data string) (string, error)

	// PasswordHash is a function to hash password using argon2id
	PasswordHash(password string) (string, error)

	// PasswordVerify is a function to verify password using argon2id
	PasswordVerify(password string, hash string) (bool, error)

	// MD5 is a function to hash data using md5
	MD5(data string) (string, error)
}

func NewCrypt

func NewCrypt() CryptService

Jump to

Keyboard shortcuts

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