crypt

package
v0.0.0-...-bc50bd5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encrypted string, passphrase string) (string, error)

Decrypt obtains the mac from the first 32 bytes of the ciphertext then checks whether its valid verifyHMAC().If it is valid it obtains the initialisation vector(16 bytes) also known as the nonce from the second batch of 32 bytes from the last byte position of the mac.It then obtains the ciphertext payload from the remaining slice of bytes:

ciphertext[48:].

It is this ciphertext payload that is now XOR'd back to plaintext

func Encrypt

func Encrypt(text string, passphrase string) (string, error)

Encrypt encrypts using the key from Hashpassword() then generates the mac of the encrypted text using GenHmac256 and then appends the ciphertext to its mac

Types

This section is empty.

Jump to

Keyboard shortcuts

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