Skip to content

Kesha005/go_encryptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go encryptor

Golang data encryptor package by Saparov

Installing

Install from repository

go get github.com/Kesha005/go_encryptor

Where to use

Encryption and decryption are used to secure data in auth,message systems and in cybersecurity

Usage

Firstly we need config our .env file and add there "SECRET_KEY" and "IV_16_KEY"

.ENV file

    
    SECRET_KEY="thismustbe16or24digitkey."
    IV_16_KEY="thisis16digitkey"
    

Example:

Import package

    import (
	"github.com/Kesha005/go_encryptor"
	"fmt"
	"github.com/joho/godotenv"

)

Encryption and decryption

    
    StringToEncrypt := "Encrypting this string"
	godotenv.Load(".env")
	fmt.Println(StringToEncrypt)
	encText, err := go_encryptor.Encrypt(StringToEncrypt)
	if err != nil {
		fmt.Println("error encrypting your classified text: ", err)
	}
	fmt.Println(encText)
	// To decrypt the original StringToEncrypt
	decText, err := go_encryptor.Decrypt(encText)
	if err != nil {
		fmt.Println("error decrypting your encrypted text: ", err)
	}
	fmt.Println(decText)