encryption

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 14, 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 verifies a plain text password against a bcrypt hash Checks if the provided password matches the hashed password Returns true if the password matches, false otherwise

func CreateHash

func CreateHash(Password string) (string, error)

CreateHash generates a bcrypt hash from a plain text password Uses the default bcrypt cost factor to create a secure hash Returns the hashed password as a string or an error if hashing fails

func Decrypt

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

Decrypt decrypts AES-encrypted data in CBC mode Decodes the input, decrypts it, removes padding, and unmarshals to the original data Supports base64 or hex decoding based on encryptionType

func Encrypt

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

Encrypt encrypts data using AES in CBC mode Converts input data to JSON, pads it, encrypts it, and encodes the result Supports base64 or hex encoding based on encryptionType

Types

This section is empty.

Jump to

Keyboard shortcuts

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