Skip to content

junekimdev/cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cipher

Cipher algorithms in Golang

PkgGoDev Go Report Card GitHub tag (latest by date) GitHub


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 😸)

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
}

About

Cipher algorithms in Golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages