Documentation
¶
Index ¶
- func CompareWithHash(HashedString string, Password string) bool
- func CreateHash(Password string) (string, error)
- func Decrypt(encryptedData models.EncryptReturnType, ...) (interface{}, error)
- func Encrypt(data interface{}, encryptionKey, initializationVector, encryptionType string) (models.EncryptReturnType, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareWithHash ¶
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 ¶
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.