crypto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashSHA1 = iota
	HashSHA256
	HashSHA512
	HashSHA512_384
	HashMD5
)

Const declarations for common.go operations

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(input string) ([]byte, error)

Base64Decode takes in a Base64 string and returns a byte array and an error

func Base64Encode

func Base64Encode(input []byte) string

Base64Encode takes in a byte array then returns an encoded base64 string

func GetHMAC

func GetHMAC(hashType int, input, key []byte) ([]byte, error)

GetHMAC returns a keyed-hash message authentication code using the desired hashtype

func GetMD5

func GetMD5(input []byte) ([]byte, error)

GetMD5 returns a MD5 hash of a byte array

func GetRandomSalt

func GetRandomSalt(input []byte, saltLen int) ([]byte, error)

GetRandomSalt returns a random salt

func GetSHA256

func GetSHA256(input []byte) ([]byte, error)

GetSHA256 returns a SHA256 hash of a byte array

func GetSHA512

func GetSHA512(input []byte) ([]byte, error)

GetSHA512 returns a SHA512 hash of a byte array

func HexEncodeToString

func HexEncodeToString(input []byte) string

HexEncodeToString takes in a hexadecimal byte array and returns a string

func Sha1ToHex

func Sha1ToHex(data string) (string, error)

Sha1ToHex takes a string, sha1 hashes it and return a hex string of the result

Types

This section is empty.

Jump to

Keyboard shortcuts

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