crypto

package
v0.0.0-...-ef2c00d Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(ciphertext, iv, key []byte) ([]byte, error)

AESDecrypt decrypts the given ciphertext using the given key and returns the plaintext.

func AESEncrypt

func AESEncrypt(plaintext, iv, key []byte) ([]byte, error)

AESEncrypt encrypts the given plaintext using the given key and returns the ciphertext.

func AESGenerateIV

func AESGenerateIV() ([]byte, error)

AESGenerateIV generates a random initialization vector (IV) of the given length.

func Base32Decode

func Base32Decode(data string) (string, error)

Base32Decode decodes the given base32 encoded data.

func Base32Encode

func Base32Encode(data string) string

Base32Encode encodes the given data using base32 encoding.

func Base64Decode

func Base64Decode(data string) (string, error)

Base64Decode decodes the given data using base64 encoding.

func Base64Encode

func Base64Encode(data string) string

Base64Encode encodes the given data using base64 encoding.

func BcryptHash

func BcryptHash(plaintext []byte) ([]byte, error)

Hash hashes the given data and returns a byte slice containing the hash.

func BcryptVerifyHash

func BcryptVerifyHash(hash, plaintext []byte) bool

BcryptVerifyHash verifies that the given hash matches the given data.

func ChaCha20Decrypt

func ChaCha20Decrypt(data, key []byte) ([]byte, error)

ChaCha20Decrypt decrypts the given ciphertext using the given key and returns the plaintext.

func ChaCha20Encrypt

func ChaCha20Encrypt(data, key []byte) ([]byte, error)

ChaCha20Encrypt encrypts the given plaintext using the given key and returns the ciphertext.

func EllipticCurveDecrypt

func EllipticCurveDecrypt(data, key []byte) ([]byte, error)

EllipticCurveDecrypt decrypts the given ciphertext using the given key and returns the plaintext.

func EllipticCurveEncrypt

func EllipticCurveEncrypt(data, key []byte) ([]byte, error)

EllipticCurveEncrypt encrypts the given data using the given key and returns the ciphertext.

func MD5Hash

func MD5Hash(data []byte) string

MD5Hash returns the MD5 hash of the given data.

func PKCS5Pad

func PKCS5Pad(content []byte, blockSize int) []byte

PKCS5Pad adds padding to the given content.

func PKCS5Trim

func PKCS5Trim(content []byte) []byte

PKCS5Trim removes the padding from the given content.

func RC4Decrypt

func RC4Decrypt(data, key []byte) ([]byte, error)

RC4Decrypt decrypts the given ciphertext using the given key and returns the plaintext.

func RC4Encrypt

func RC4Encrypt(data, key []byte) ([]byte, error)

RC4Encypt encrypts the given data using the given key and returns the ciphertext.

func ROT13

func ROT13(data string) string

ROT13 encodes the given data using the ROT13 cipher and returns the ciphertext.

func ROT47

func ROT47(data string) string

ROT47 encodes the given data using the ROT47 cipher and returns the ciphertext.

func SHA1

func SHA1(data []byte) string

SHA1 is a cryptographic hash function that produces a 160-bit hash value known as a message digest.

func SHA256

func SHA256(data []byte) string

SHA256 is a cryptographic hash function that produces a 256-bit hash value known as a message digest.

func SHA512

func SHA512(data []byte) string

SHA512 is a cryptographic hash function that produces a 512-bit hash value known as a message digest.

func TripleDESDecrypt

func TripleDESDecrypt(data, key []byte) ([]byte, error)

TripleDESDecrypt decrypts the given data using Triple DES

func TripleDESEncrypt

func TripleDESEncrypt(data, key []byte) ([]byte, error)

TripleDESEncrypt encrypts the given data using Triple DES

func VerifyMD5Hash

func VerifyMD5Hash(hash, password string) bool

VerifyMD5Hash verifies that the given data matches the given MD5 hash.

func VerifySHA1

func VerifySHA1(data []byte, hash string) bool

VerifySHA1 verifies the SHA1 hash of the given data and returns true if the hash is valid, and false otherwise.

func VerifySHA256

func VerifySHA256(data []byte, hash string) bool

VerifySHA256 verifies the SHA256 hash of the given data and returns true if the hash is valid, and false otherwise.

func VerifySHA512

func VerifySHA512(data []byte, hash string) bool

VerifySHA512 verifies the SHA512 hash of the given data and returns true if the hash is valid, and false otherwise.

func XOR

func XOR(buf, xor []byte) []byte

XOR applies the XOR operation to the given data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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