cryptoUtil

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

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodedHash

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

DecodedHash returns the decoded hash of the given hex string

func DecryptAES256

func DecryptAES256(key []byte, securemess []byte) (decodedmess []byte, err error)

DecryptAES256 ....

func DecryptMessage

func DecryptMessage(message []byte, passPhrase string) ([]byte, error)

DecryptMessage decrypts an encrypted message using a password

func EncodedHash

func EncodedHash(s string) string

EncodedHash returns the hex encoded hash of the given string

func EncryptAES256

func EncryptAES256(key []byte, plaintext []byte) (encmess []byte, err error)

EncryptAES256 encrypts a message using AES-256-GCM

key is the encryption key (must be 32 bytes)
message is the string to be encrypted
returns the (b64 encoded) encrypted message, or an error if the key is not 32 bytes

func EncryptMessage

func EncryptMessage(message []byte, passPhrase string) ([]byte, error)

EncryptMessage encrypts a message using a password

func FNV32a

func FNV32a(text string) uint32

FNV32a hashes using fnv32a algorithm

func Hash

func Hash(s string) []byte

Hash using SHA3-256

func IndexFromString

func IndexFromString(text string) uint32

IndexFromString returns the unique (hash) index of an arbitrary string

func SecureRandomStr

func SecureRandomStr(length int) (string, error)

SecureRandomStr returns a random string of the given length

length: the length of the string to return
returns: a random string of the given length
				 error: if an error occurs
notes: uses crypto/rand to generate random bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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