security

package
v0.0.0-...-5c09645 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 8 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

View Source
var ErrDigest = errors.New("value does not have correct digest")

ErrDigest signals a checksum mismatch

Functions

func Decrypt

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

Decrypt reverses Encrypt e is the crypted+encoded string

MakeKey is the best way to derive a key

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

MakeKey is the best way to derive a key

func MakeKey

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

MakeKey returns a 32-len byte

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