crypt

package
v0.0.0-...-0b6a14b Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2017 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hash = map[string](HashAlgorithm){
	"MD5":    Md5,
	"SHA1":   Sha1,
	"SHA256": Sha256,
	"SHA512": Sha512,
}

Hash provides quick access to hashing functions through a map.

Functions

func AesDecryptCbc

func AesDecryptCbc(ciphertext, key, iv []byte) (dec []byte, err error)

AesDecryptCbc decrypts ciphertext with a key and an IV.

func AesEncryptCbc

func AesEncryptCbc(plaintext, key, iv []byte) (enc []byte, err error)

AesEncryptCbc encrypts a plaintext byte slice in CBC mode. It returns an encrypted byte slice.

func Md5

func Md5(dataIn []byte) (dataOut []byte)

Md5 performs MD5 on a byte slice and returns the MD5 hash as a byte slice.

func Sha1

func Sha1(dataIn []byte) (dataOut []byte)

Sha1 performs SHA1 on a byte slice and returns the SHA1 hash as a byte slice.

func Sha256

func Sha256(dataIn []byte) (dataOut []byte)

Sha256 performs SHA256 on a byte slice and returns the SHA256 hash as a byte slice.

func Sha512

func Sha512(dataIn []byte) (dataOut []byte)

Sha512 performs SHA512 on a byte slice and returns the SHA512 hash as a byte slice.

func Xor

func Xor(data *([]byte), key byte)

Xor performs single-byte XOR on a data buffer.

Types

type HashAlgorithm

type HashAlgorithm func([]byte) []byte

A HashAlgorithm takes a slice of bytes, hashes it with an algorithm, and returns the hashed byte slice, which is more flexible/generic than a fixed array.

Jump to

Keyboard shortcuts

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