# README
Cipher
Cipher algorithms in Golang
Getting Started
Prerequisite
Create .env
file in your root directory and add below variables
- CIPHER_PASSWORD
- CIPHER_SALT
Note: Rotate password/salt pair regularly
When encryption runs more than 2^32 times, Nonce is at the risk of a repeat
Installing
go get it (pun intended :smile_cat:)
go get github.com/junekimdev/cipher
Usage
package main
import (
"log"
"github.com/junekimdev/cipher"
)
func main() {
// text to encrypt
encrypted, err := cipher.Encrypt(text)
// encrypted text to decrypt
decrypted, err := cipher.Decrypt(string(encrypted))
////---- decrypted == text
// a file to encrypt
cipher.EncryptFile(plainTextFile1, encryptedFile)
// encrypted text to decrypt
cipher.DecryptFile(encryptedFile, plainTextFile2)
////---- plainTextFile1 == plainTextFile2
}
# Functions
Decrypt encrypted text with GCM cipher.
DecryptFile decrypts an encrypted file with CTR cipher.
Encrypt plaintext with GCM cipher.
EncryptFile encrypts a file with CTR cipher.
# Variables
Error.