Documentation ¶
Index ¶
Constants ¶
const ( // HashLen represents the length of the hash. HashLen = 8 // MaskLen represents the length of the mask. MaskLen = 16 // KeyLen represents the length of the key. KeyLen = 256 // OptimizeEncryption is used to optimize encryption. OptimizeEncryption Mode = 0 // OptimizeDecryption is used to optimize decryption. OptimizeDecryption Mode = 1 )
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts the given source data using the provided key and mode. It returns the decrypted data, a boolean indicating whether the decryption was successful, and an error if any occurred. The key must be a byte slice with a length between 1 and 256. The source data must have a length greater than or equal to MaskLen + HashLen. If the mode is OptimizeEncryption, the source data is unshuffled using the key. If the mode is not OptimizeEncryption, the source data is shuffled using the key.
func Encrypt ¶
Encrypt encrypts the source data using the provided key and mode. It returns the encrypted data and an error if any. The key must be a byte slice with a length between 1 and 256. The source data must be a byte slice. The mode parameter determines the encryption mode. If mode is OptimizeEncryption, the key and result will be shuffled. If mode is not OptimizeEncryption, the key and result will be unshuffled.