Giter Site home page Giter Site logo

3dfosi / gocrypt Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 66 KB

A package that provides simplified helper functions for using scrypt (128-bit salt, N=32768, r=8 and p=1) generated hash as a key to encrypt data with AES-256-GCM.

License: Apache License 2.0

Go 100.00%

gocrypt's Introduction

GoCrypt - A Golang Encryption Helper Package

maintained by: hkdb


gocrypt


SUMMARY:

Package 3dfosi/gocrypt provides simplified helper functions for using scrypt (128-bit salt, N=32768, r=8 and p=1) generated hash as a key to encrypt data with AES-256-GCM.

Common use cases include but are not limited to encrypting data at rest for applications and symetric encryption automation prior to transfering files to destination.

USAGE:

Import package:

import "github.com/3dfosi/gocrypt"

Example:

package main

import (
	"encoding/hex"
	"log"

	"github.com/3dfosi/gocrypt"
)

var passphrase = "SOME-CRAZY-LONG-PASSPHRASE"

func main() {

	// Encrypt Data
	encrypted_data, salt, err := gocrypt.Encrypt([]byte("Hello World"), passphrase)
	if err != nil {
		log.Println(err)
		return
	}
	log.Println("Encrypted DATA:", hex.EncodeToString(encrypted_data))
	log.Println("SALT:", hex.EncodeToString(salt))

	// Decrypt Data
	plaintext, err := gocrypt.Decrypt(encrypted_data, salt, passphrase)
	if err != nil {
		log.Println(err)
		return
	}
	log.Println("Plain Text:", string(plaintext))

}

DOCUMENTATION

Check out the documentation for further details on the functions available.

CHANGE

  • 09182022 - Initial commit

SUPPORT US!

If this repo was useful to you, feel free to buy us some coffees! :)

"Buy Me A Coffee"

DISCLAIMER

This repo is sponsored by 3DF OSI and is maintained by volunteers. 3DF Limited, 3DF OSI, and its volunteers in no way make any guarantees. Please use at your own risk!

To Learn more, please visit:

https://osi.3df.io

https://3df.io

gocrypt's People

Contributors

hkdb avatar

Stargazers

Gabriel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.