cipher

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CBC_IV_SIZE uint64 = 16
View Source
const GCM_ADATA_SIZE uint64 = 16
View Source
const GCM_IV_SIZE uint64 = 12
View Source
const PASSWORD_KEY_LENGTH = 32
View Source
const SALT_LENGTH = 16

Variables

This section is empty.

Functions

func ComparePWHash

func ComparePWHash(plaintext string, hashWithSalt string) bool

func CreateHmac

func CreateHmac(message []byte, key []byte) []byte

func DecryptAesCbc

func DecryptAesCbc(iv, key, data []byte) ([]byte, error)

func DecryptAesGcm

func DecryptAesGcm(key []byte, cryptoText string) ([]byte, error)

decrypt from base64 to decrypted string (strip iv->adata off front of ciphertext)

func EncryptAesCbc

func EncryptAesCbc(iv []byte, key []byte, data []byte) ([]byte, error)

func EncryptAesGcm

func EncryptAesGcm(key []byte, plaintext []byte) (string, error)

encrypt string to base64 crypto using AES GCM Mode (ciphertext is iv->adata->ciphertext)

func NewPWHash

func NewPWHash(plaintext string, salt []byte) (string, error)

nil salt is for new salt

func PermuteWithMask

func PermuteWithMask(original []byte, mask []byte) ([]byte, error)

permute with mask

func Pkcs7Pad

func Pkcs7Pad(data []byte, blocklen int) []byte

Appends padding.

func Pkcs7Unpad

func Pkcs7Unpad(data []byte, blocklen int) ([]byte, error)

Returns slice of the original data without padding.

func RandomBytes

func RandomBytes(byteLength uint64) ([]byte, error)

func ValidateHmac

func ValidateHmac(sig []byte, message []byte, key []byte) bool

func WrapTortilla

func WrapTortilla(plaintext []byte, publicKey []byte, aesCharif []byte, aesTortilla []byte) ([]byte, error)

Tortilla

Types

This section is empty.

Jump to

Keyboard shortcuts

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