utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptHash

func BcryptHash(tohash []byte) ([]byte, error)

BcryptHash hashes a given byte array with bcrypt and a cost of 10

func BycrptVerify

func BycrptVerify(comparable, verifiable []byte) error

BycrptVerify compares a bcrypted comparable and its plain byte array

func DecodeBase32Key

func DecodeBase32Key(encodedKey string) ([]byte, error)

DecodeBase32Key Decodes a base32 encoded key to a byte array

func Decrypt

func Decrypt(data, passphrase []byte) []byte

Decrypt takes in two byte arrays. The former one is the encrypted data, the second one is the passphrase that shall be used. The method returns the decrypted data in another byte array Attention: It is assumed that a nonce is appended to the encrypted byte array!

func DecryptFile

func DecryptFile(filePath string, passphrase []byte) []byte

DecryptFile takes a filePath as a string and a passphrase as a byte array. The file found at filePath is then decrypted using the Decrypt Method and then wrote back to the original filePath

func Encrypt

func Encrypt(data, passphrase []byte) []byte

Encrypt takes in a byte array as data and another byte array as the passphrase, encrypts the data using the AES cipher and returns the encrypted data (also as byte array) please note that the nonce needed to encrypt the data using AES GCM is appended to the byte array

func EncryptFile

func EncryptFile(filePath string, data, passphrase []byte)

EncryptFile takes a filePath as a string and a passphrase as a byte array. The file found at filePath is then Encrypted using the Encrypt Method and then wrote back to the original filePath

Types

This section is empty.

Jump to

Keyboard shortcuts

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