encryption

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareWithHash

func CompareWithHash(HashedString string, Password string) bool

CompareWithHash compares a password with a bcrypt hash. HashedString: The bcrypt hashed password. Password: The plain text password to be checked. Returns true if the password matches the hash, false otherwise.

func CreateHash

func CreateHash(Password string) (string, error)

CreateHash generates a bcrypt hash from the provided password. Password: The plain text password to be hashed. Returns the hashed password string, or an error if the hashing fails.

func Decrypt

func Decrypt(encryptedData models.EncryptReturnType, encryptionKey, initializationVector, encryptionType string) (interface{}, error)

Decrypt decrypts the provided encrypted data using AES encryption in CBC mode with the specified parameters. encryptedData: The encrypted data in the specified format ("base64" or "hex"). encryptionKey: The key used for decryption (must be 16, 24, or 32 bytes). initializationVector: The IV used for CBC mode (must be 16 bytes). encryptionType: The encryption format ("base64" or "hex") that was used for encryption.

func Encrypt

func Encrypt(data interface{}, encryptionKey, initializationVector, encryptionType string) (models.EncryptReturnType, error)

Encrypt encrypts the provided data using AES encryption in CBC mode with the specified parameters. encryptionKey: The key used for encryption (must be 16, 24, or 32 bytes). initializationVector: The IV used for CBC mode (must be 16 bytes). encryptionType: The desired encryption format ("base64" or "hex").

Types

This section is empty.

Jump to

Keyboard shortcuts

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