crypto

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

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

const declarations for common crypto 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 CheckCerts

func CheckCerts(certDir string) error

CheckCerts will check to see if certificates exist in the supplied directory, and then verify that the certificate is not expired. If no certificates exist, or they are expired, it will create new self-signed certificates.

func GetHMAC

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

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

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 GetTLSDir

func GetTLSDir(dir string) string

GetTLSDir returns the default TLS dir

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