Skip to content

gowww/crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

199099e · Apr 5, 2023

History

15 Commits
Jul 3, 2017
Jul 3, 2017
Jul 3, 2017
Jul 12, 2017
Jul 4, 2017
Jul 4, 2017
Jul 4, 2017
Sep 11, 2020
Apr 5, 2023
Aug 1, 2017
Jul 4, 2017
Jul 4, 2017

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)