Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const HashLength = 32
HashLength is the standardized length of a hash.
Variables ¶
This section is empty.
Functions ¶
func Sha3String ¶
Sha3String hashes a given message via sha3 and encodes the hashed message to a hex string.
Types ¶
type AesEncrypt ¶
type AesEncrypt struct {
Key string
}
AesEncrypt
func (*AesEncrypt) Decrypt ¶
func (a *AesEncrypt) Decrypt(src []byte) (strDesc []byte, err error)
Decrypt
Example ¶
aesEnc := AesEncrypt{"1234334"} arrEncrypt, err := aesEnc.Encrypt([]byte("abcdef")) if err != nil { log.Println(arrEncrypt) return } aesDec := AesEncrypt{"1234335"} strMsg, err := aesDec.Decrypt(arrEncrypt) if err != nil { fmt.Printf("error password") return } fmt.Println(string(strMsg))
Output: error password
func (*AesEncrypt) Encrypt ¶
func (a *AesEncrypt) Encrypt(strMesg []byte) ([]byte, error)
Encrypt
Example ¶
aesEnc := AesEncrypt{"1234334"} arrEncrypt, err := aesEnc.Encrypt([]byte("abcdef")) if err != nil { log.Println(arrEncrypt) return } strMsg, err := aesEnc.Decrypt(arrEncrypt) if err != nil { log.Println(arrEncrypt) return } fmt.Println(string(strMsg))
Output: abcdef
type Hash ¶
type Hash [HashLength]byte
Hash represents the streamlined hash type to be used.
func HashFromString ¶
HashFromString returns a Hash type given a hex string.
Click to show internal directories.
Click to hide internal directories.