Skip to content

A pair of command-line tools to encrypt/decrypt text

License

Notifications You must be signed in to change notification settings

ZenulAbidin/encdec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encdec

What is this?

Encdec is a pair of command-line tools I wrote to encrypt and decrypt text data. As implied by the name, one program encrypts the data, the other decrypts the encryption generated by the first program to get the origional data.

What kind of encryption is used?

Encdec uses AES-CBC-256 with a constant IV, and a key that is derived from the SHA256 hash of a user-supplied password. Buffer overruns are not possible, because a salt as well as the length of the original message is also encoded into the data before it is encrypted. Additionally, a salt is used in the SHA256-derived key as well to stop preimage attacks.

Invocation

To encrypt text, simply run ./encrypt. It will prompt you for text data and a password. Only ASCII data is supported, the use of 8-bit characters or Unicode is not guarrenteed to encode the message correctly. As a workaround, you can encode your text in Base64 before encrypting, using another tool.

Multiline data currently is not supported - if absolutely necessary, escape newlines using HTML encoding notation or base64.

Supported Platforms

Encdec works on all platforms that can compile GNU Makefile-based projects. Linux and macOS are supported out of the box. On Windows, you should use Mingw64 on MSYS2 to compile Encdec.

Building

Ensure that you have the fmt package installed in your package manager or MSYS2 - currently there is no version of g++ that supports std::fmt as of 2022.

make
# To make a portable release on Windows, you need to bundle all the system DLL files.
# Just run the following in an MSYS2 shell to do this:
$BUILD_FOLDER=build
mkdir $BUILD_FOLDER
cp *.exe $BUILD_FOLDER
ldd $BUILD_FOLDER/* | grep -iv system32 | grep -vi windows | grep -v :$  | cut -f2 -d\> | cut -f1 -d\( | tr \\ / | while read a; do ! [ -e "$BUILD_FOLDER/`basename $a`" ] && cp -v "$a" $BUILD_FOLDER/; done

License

This project is released under the zlib license.

About

A pair of command-line tools to encrypt/decrypt text

Resources

License

Stars

Watchers

Forks

Packages

No packages published