chacha

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

chacha

Easily encrypt/decrypt data or file using chacha20

to use in your project

  • in code
import "github.com/4zv4l/chacha"
  • in terminal
    go get github.com/4zv4l/chacha

variable

There is a :
var Buff_size int = 2048
Allowing to change the buffer size (can increase speed when enc/dec files)

Documentation

Overview

Package chacha is a layer to the package golang.org/x/crypto/chacha20poly1305 allowing to easily encrypt/decrypt data or files

Index

Constants

This section is empty.

Variables

View Source
var BuffSize int = 2048

BuffSize is the size of the buffer used when reading from file it is set to 2048 bytes (2kb) by default

Functions

func DecryptChaCha20

func DecryptChaCha20(key, nonce, ct []byte) ([]byte, error)

DecryptChaCha20 decrypts ct (cipher text) using the key and the nonce return the cipher text or an error

func DecryptFile

func DecryptFile(in, out *os.File, key, nonce string) error

DecryptFile take : input/output file, key and nonce in hex then decrypt the file and store result in the output file takes care to change the nonce every time the buffer length is reached

func EncryptChaCha20

func EncryptChaCha20(key, nonce, pt []byte) ([]byte, error)

EncryptChaCha20 encrypts pt (plain text) using the key and the nonce return the cipher text or an error

func EncryptFile

func EncryptFile(in, out *os.File, key, nonce string) error

EncryptFile takes : input/output file, key and nonce in hex then encrypt the file and store result in the output file takes care to change the nonce every time the buffer length is reached

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL