cryptography

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cryptography provides symmetric authenticated encryption using 256-bit AES-GCM with a random nonce.

Index

Constants

View Source
const PasswordCost = 14

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash compares a bcrypt hashed password with its possible plaintext equivalent. Returns bool if the password match, false otherwise.

func Decrypt

func Decrypt(cipherText []byte, plainKey *string) ([]byte, error)

Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.

func Encrypt

func Encrypt(plainText []byte, plainKey *string) ([]byte, error)

Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword generates a bcrypt hash of the password. Uses a work factor of PasswordCost.

Types

This section is empty.

Jump to

Keyboard shortcuts

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