Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crypto ¶
type Crypto interface {
// Hash make hash for data
Hash(data string, algo HashAlgo) (string, error)
// HashFilename make hashed filename based on current timestamp
HashFilename(filename string, algo HashAlgo) (string, error)
// HashSize get hash size for algorithm
// return -1 if invalid algo passed
HashSize(algo HashAlgo) int
// Check check data against hash
Check(data string, hash string, algo HashAlgo) (bool, error)
// Encrypt data
Encrypt(data []byte) ([]byte, error)
// Decrypt data
Decrypt(data []byte) ([]byte, error)
// EncryptHEX encrypt data and return encrypted value as hex encoded string
EncryptHEX(data []byte) (string, error)
// DecryptHex decrypt data from hex encoded string.
DecryptHex(hexString string) ([]byte, error)
// EncryptBase64 encrypt data and return encrypted value as base64 encoded string
EncryptBase64(data []byte) (string, error)
// DecryptBase64 decrypt data from base64 encoded string.
DecryptBase64(base64String string) ([]byte, error)
}
Crypto cryptography interface
func NewCryptography ¶
NewCryptography create a new cryptography instance
type HashAlgo ¶
type HashAlgo int
HashAlgo available hash algo list
const ( // MD4 hash algorithm MD4 HashAlgo = iota + 1 // MD5 hash algorithm MD5 // SHA1 hash algorithm SHA1 // SHA256 hash algorithm SHA256 // SHA256224 hash algorithm SHA256224 // SHA384 hash algorithm SHA384 // SHA512 hash algorithm SHA512 // SHA512224 hash algorithm SHA512224 // SHA512256 hash algorithm SHA512256 // SHA3224 hash algorithm SHA3224 // SHA3256 hash algorithm SHA3256 // SHA3384 hash algorithm SHA3384 // SHA3512 hash algorithm SHA3512 // KECCAK256 hash algorithm KECCAK256 // KECCAK512 hash algorithm KECCAK512 )
Click to show internal directories.
Click to hide internal directories.