FileEncryption

package module
v0.0.0-...-1ce69ae Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 8 Imported by: 0

README

How to install

  • Get the library using:
go get github.com/Tiked/FileEncryption
  • Import it:
import "github.com/Tiked/FileEncryption"

How to use it

package main
import "github.com/Tiked/FileEncryption"

func main() {
  // First initialize the chipher with your key. use a 32 bytes slice
  FileEncryption.InitializeBlock([]byte("a very very very very secret key"))
  
  // Now encrypt a file with its path
  err := FileEncryption.Encrypter("/home/desktop/data.txt")
  if err != nil {
    panic(err.Error())
  }
  // Now you should see data.txt.enc in your desktop
  
  // To decrypt it
  err = FileEncryption.Decrypter("/home/desktop/data.txt.enc")
  if err != nil {
    panic(err.Error())
  }
  // Now you should see data.txt in your desktop
  
}

Features

  • Encrypts large files using stream encryption
  • Per-file unique IV handling

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ext = ".enc"

Ext is the encrypted appended extension

Functions

func Decrypter

func Decrypter(path string) (err error)

Decrypter decryps a file given its filepath

func Encrypter

func Encrypter(path string) (string, error)

Encrypter encrypts a file given its filepatth

func InitializeBlock

func InitializeBlock(myKey []byte)

InitializeBlock Sets up the encription with a key

Types

This section is empty.

Jump to

Keyboard shortcuts

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