security

package
v0.0.0-...-8e2c34a Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package security provides crypto and hashing support

Index

Constants

View Source
const KeyLen = 32

KeyLen is the encryption key length

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(e string, key []byte) (string, error)

Decrypt reverses Encrypt e is the crypted+encoded string

func DerivePassword

func DerivePassword(password string, cfg argon2.Config) (string, error)

DerivePassword performs a one-way hash on a password using argon2

func EncodedSHA256

func EncodedSHA256(s string) string

EncodedSHA256 returns the encoded (base16) sha256sums

func Encrypt

func Encrypt(s string, key []byte) (string, error)

Encrypt returns the hex-encoded AES symmetric encryption of s with key

func MakeKey

func MakeKey(s string) ([]byte, error)

MakeKey returns a 32-len byte

func SafeStr

func SafeStr(s string) bool

SafeStr makes sure a string is safe for storage

func VerifyPassword

func VerifyPassword(guess, derived string) (bool, error)

VerifyPassword returns true if guess is the same as the password forming derived

Types

This section is empty.

Jump to

Keyboard shortcuts

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