fcrypt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 5 Imported by: 0

README

fcrypt - file encryption/decryption golang library

go logo

project structure:

├── fcrypt.go
├── go.mod
├── LICENSE
└── README.md

installation

go get github.com/kenjitheman/fcrypt

usage

package main

import (
	"fmt"

	"github.com/kenjitheman/fcrypt"
)

func main() {
	key := []byte("examplekeyexampl") // 16, 24, or 32 bytes for AES-128, AES-192, AES-256

	inputFile := "./man.txt"
	encryptedFile := "./encrypted.enc"
	decryptedFile := "./decrypted.txt"

	err := fcrypt.EncryptFile(key, inputFile, encryptedFile)
	if err != nil {
		fmt.Println("[ERROR] encryption error:", err)
		return
	}

	fmt.Println("[SUCCESS] file encrypted successfully")

	err = fcrypt.DecryptFile(key, encryptedFile, decryptedFile)
	if err != nil {
		fmt.Println("[ERROR] decryption error:", err)
		return
	}

	fmt.Println("[SUCCESS] file decrypted successfully")
}

contributing

  • pull requests are welcome, for major changes, please open an issue first to discuss what you would like to change

license

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFile

func DecryptFile(key []byte, inputFile, outputFile string) error

func EncryptFile

func EncryptFile(key []byte, inputFile, outputFile string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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