Skip to content

gowww/crypto

Repository files navigation

gowww crypto GoDoc Build Coverage Go Report Status Stable

Package crypto provides encryption and hashing utilities.

Installing

  1. Get package:

    go get -u github.com/gowww/crypto
  2. Import it in your code:

    import "github.com/gowww/crypto"

Usage

Use NewEncrypter with a 32 bytes long secret key to make a new Encrypter:

encrypter, _ := crypto.NewEncrypter([]byte("secret-key-secret-key-secret-key"))

Use Encrypter.Encrypt or Encrypter.EncryptBase64 to encrypt a value:

encryptedData, _ := encrypter.Encrypt([]byte("data to encrypt"))

Use Encrypter.Decrypt or Encrypter.DecryptBase64 to decrypt a value:

decryptedData, _ := encrypter.Decrypt(encryptedData)