crypto

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAuth

func DecryptAuth(c, dk, ad []byte) ([]byte, error)

DecryptAuth decrypts a given base64 encoded ciphertext byte array and IV byte array and returns the plaintext as byte array

func EncryptAuth

func EncryptAuth(pd, ek, ad []byte) ([]byte, error)

EncryptAuth encrypts a plaintext byte array with authentication data byte array and returns the IV and CipherText as byte array

func RandDuration added in v0.1.7

func RandDuration(n int, u string) (time.Duration, error)

RandDuration returns a random time.Duration in u with a maximum value of the given n

func RandNum

func RandNum(n int) (int, error)

RandNum returns a random number with a maximum value of n

func RandomBytes

func RandomBytes(n int64) ([]byte, error)

RandomBytes uses the crypto/rand generator to generate random bytes. The amount of provided random bytes is controlled by the n argument

func RandomStringSecure

func RandomStringSecure(n int, s, h bool) (string, error)

RandomStringSecure returns a random, n long string of characters. The character set is based on the s (special chars) and h (human readable) boolean arguments. This method uses the crypto/random package and therfore is cryptographically secure

Types

This section is empty.

Jump to

Keyboard shortcuts

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