Documentation ¶
Index ¶
- func AesGCMDecrypt(ciphertext []byte, key []byte) ([]byte, error)
- func AesGCMEncrypt(plaintext []byte, key []byte) ([]byte, error)
- func CompareChecksums(first []byte, second []byte) bool
- func ComputeMd5Checksum(data []byte) []byte
- func ComputeMd5ChecksumString(data []byte) string
- func ComputeSha256Checksum(data []byte) []byte
- func GenerateAesKey() []byte
- func GenerateSalt(length int) []byte
- func GetHmac256(message string, secret string) string
- func GetPBKFS2AesKey(passphrase string, salt []byte) []byte
- func GetRandomInt(min, max int) int
- func GetRandomString(length int, charSet string) string
- func GetScryptAesKey(passphrase string, salt []byte) []byte
- func GetSha256HashString(data []byte) string
- func GetSha256HashStringFromStream(stream io.Reader) string
- func ValidateMd5Checksum(data []byte, sum []byte) bool
- func ValidateSha256Checksum(data []byte, sum []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesGCMDecrypt ¶
AesGCMDecrypt Decrypt data using AES with the GCM cipher mode (Gives Confidentiality and Authenticity)
func AesGCMEncrypt ¶
AesGCMEncrypt Encrypt data using AES with the GCM cipher mode (Gives Confidentiality and Authenticity)
func CompareChecksums ¶
CompareChecksums Compare two check sums. Return true if they are they same
func ComputeMd5Checksum ¶
ComputeMd5Checksum This returns the data's MD5 checksum.
WARNING: Do NOT Use MD5 in security contexts (defending against intentional manipulations of data from untrusted sources); use only for checking data integrity against machine errors.
func ComputeMd5ChecksumString ¶
ComputeMd5ChecksumString returns the md5 checksum
func ComputeSha256Checksum ¶
ComputeSha256Checksum This returns the data's Sha256 checksum
func GenerateAesKey ¶
func GenerateAesKey() []byte
GenerateAesKey will generate a new 32 byte key (Uses OS random source)
func GenerateSalt ¶
GenerateSalt will generate and return a random salt
func GetHmac256 ¶
GetHmac256 will generate a HMAC hash encoded to base64
func GetPBKFS2AesKey ¶
GetPBKFS2AesKey will generate a AES key from a passphrase using PBKFS2
func GetRandomString ¶
GetRandomString Generate a Random secret
func GetScryptAesKey ¶
GetScryptAesKey will generate a AES key from a passphrase using Scrypt
func GetSha256HashString ¶
GetSha256HashString This returns the data's Sha256 checksum as a string representation
func GetSha256HashStringFromStream ¶
GetSha256HashStringFromStream Return a hash from a stream reader
func ValidateMd5Checksum ¶
ValidateMd5Checksum This returns true if the data matches the provided checksum.
func ValidateSha256Checksum ¶
ValidateSha256Checksum This returns true if the data matches the provided checksum.
Types ¶
This section is empty.