# Safenc

## Introduction
**Safenc** is a simple command-line tool to encrypt your data. Whether it's a file, folder or just text it can be encrypted using key that can be **Any File** (photo, video, pdf, etc) or password and unless someone has that password or specific file that was used as key to encrypt, they can't  decrypt the original data.
## Installation

Install directly via pip (virtual enviroment reccomended):

```bash
pip install safenc
```
then run it using 
```bash
safenc [options]
```
for manual clone this repo `https://github.com/8oruz/safenc` and add addition package `cryptography` using pip and run `safenc.py`

## Options
- `--input file-path` or `-i file-path` to specify file path to encrypt and if input is text use `-i "@text"`
- `--key key-path` or `-k key-path` to specify path of file to be used as key. It could be any file png, pdf, doc etc, if to use password can use `-k "#password"`
- `--output output-path` or `-o output-path` to give output path that will be used to store encrypted data if  encryption and decrypted data if decrypted **if not given output will print in terminal**.
- `--decrypt` or `-d` To specify the task as decryption **without it there will be only encryption.**
- `--base64` or `-b` if wanted encryption output in base64 format and **in decryption requried if encrypted in base64**.

## Usage Examples

**Encrypting a file using image as key**
```bash
safenc -i input-file -k /path/of/image.png -o encrypted-file
```
**Decrypting same file**
```bash
safenc --decrypt -i encrypted-file -k /path/to/image.png -o original-file
```
**Encrypting a Folder**
```bash
safenc -i /path/to/folder -k key-file.pdf -o encrypted-file
```
**Decrypting same folder**
```bash
safenc -d -i encrypted-file -k key-file.pdf -o /path/to/result
```
**Encrypting a file with password**
```bash
safenc -i input-file -k "#password" -o output-path
```
**Encrypting text with password and print result as base64**
```bash
safenc -i "@any text" -k "#password" --base64
```
**Encrypting a file with password and save as base64**
```bash
safenc -i file-path -k "#password" --base64 -o output
```
**Decryption of same file**
```bash
safenc --decrypt -i encrypted-file -k "#password" --base64 -o original-file
```
