All Projects β†’ philipperemy β†’ easy-encryption

philipperemy / easy-encryption

Licence: MIT License
A very simple C++ module to encrypt/decrypt strings based on B64 and Vigenere ciper.

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to easy-encryption

Sqleet
SQLite3 encryption that sucks less
Stars: ✭ 244 (+125.93%)
Mutual labels:  encryption
aliceandbob
πŸ” A free, light and easy to use client-side tool to generate PGP key pairs, encrypt and decrypt messages.
Stars: ✭ 24 (-77.78%)
Mutual labels:  encryption
CameraV
CameraV: InformaCam Default Android App
Stars: ✭ 81 (-25%)
Mutual labels:  encryption
Syphon
βš—οΈ a privacy centric matrix client
Stars: ✭ 245 (+126.85%)
Mutual labels:  encryption
Setup Ipsec Vpn
Scripts to build your own IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2
Stars: ✭ 16,987 (+15628.7%)
Mutual labels:  encryption
diary-app
πŸ”An End-To-End Encrypted Diary Web App
Stars: ✭ 83 (-23.15%)
Mutual labels:  encryption
Peertransfer
πŸ“¦ β€’ Send a file p2p and e2e encrypted in your browser using WebRTC.
Stars: ✭ 238 (+120.37%)
Mutual labels:  encryption
jackpair
p2p speech encrypting device with analog audio interface suitable for GSM phones
Stars: ✭ 26 (-75.93%)
Mutual labels:  encryption
Jawbreaker
A Python obfuscator using HTTP Requests and Hastebin.
Stars: ✭ 50 (-53.7%)
Mutual labels:  b64
FlashPaper
One-time encrypted password/secret sharing
Stars: ✭ 85 (-21.3%)
Mutual labels:  encryption
Sio
Go implementation of the Data At Rest Encryption (DARE) format.
Stars: ✭ 248 (+129.63%)
Mutual labels:  encryption
Openssl
TLS/SSL and crypto library
Stars: ✭ 17,157 (+15786.11%)
Mutual labels:  encryption
userless
A client and server side solution for zero knowledge authentication, in Go
Stars: ✭ 15 (-86.11%)
Mutual labels:  encryption
Lurch
XEP-0384: OMEMO Encryption for libpurple.
Stars: ✭ 245 (+126.85%)
Mutual labels:  encryption
shadowsocks-libev-nocrypto
libev port of shadowsocks. In this fork, encryption is optional!
Stars: ✭ 24 (-77.78%)
Mutual labels:  encryption
Helib
HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
Stars: ✭ 2,749 (+2445.37%)
Mutual labels:  encryption
DiscordEncryption
πŸ” Configurable end to end encryption for Discord
Stars: ✭ 30 (-72.22%)
Mutual labels:  encryption
spring-data-mongodb-encrypt
Lightweight library for simple & easy per-field encryption in mongodb+spring
Stars: ✭ 62 (-42.59%)
Mutual labels:  encryption
OormiPass
Free open source cross platform password manager
Stars: ✭ 50 (-53.7%)
Mutual labels:  encryption
infinitree
Scalable and encrypted embedded database with 3-tier caching
Stars: ✭ 80 (-25.93%)
Mutual labels:  encryption

Easy Encryption

A very simple standalone C++ module (API) to obfuscate/deobfuscate strings based on B64 and Vigenere ciper (symmetric cipher).

DISCLAIMER: This encryption is NOT secure and can be used as a "cheap way" to obfuscate some messages in a communication channel. If you need a solid and unbreakable encryption, please use a widely adopted standard and well researched cipher like AES-GCM. You can find more information there: pyca.

It works as follows:

  • Alice encodes in base64 the message, then uses the Vigenere private key to encrypt the message.
  • The encrypted message is sent through an unsecured channel.
  • Bob gets the message and decrypts it with the Vigenere private key. He then decodes it with base64.

Diagram summary:


Message -> B64 ENCODE -> VIGENERE ENCRYPT -> encrypted message -> VIGENERE DECRYPT -> B64 DECODE -> Message


The reason why we apply b64 encode BEFORE Vigenere is because it's very easy for somebody to apply a b64 decode and see about the structure of the message. For example, if we send {"hello":123}, an attacker can sniff the message, b64 decode the message and get {"qsggn":ygf}. Of course the attacker still needs the Vigenere cipher key, but at least, he can get a pretty clear idea that JSON format messages are sent in the communication channel. The way to avoid this is to encode first in b64 then encrypt it with the Vigenere key. If the attacker tries to b64 decode first, it will see a random string of weird characters.

API

C++

  • Encrypt message
std::string encrypt(std::string& msg, std::string& key)
  • Decrypt message
std::string decrypt(std::string& encrypted_msg, std::string& key)

Python

  • Encrypt message
wrapper.encrypt(message, key): returns encrypted message
  • Decrypt message
wrapper.decrypt(encrypted_message, key): returns decrypted message

Compilation and execution

g++ cl.cpp
./a.out "Hello world" MYPRIVATEKEY 0

The encrypted message is: ttz9JqxZHBClNtu=.

./a.out ttz9JqxZHBClNtu= MYPRIVATEKEY 1

The decrypted message is Hello world.

Python wrapper

rm a.out
g++ cl.cpp
python3 wrapper.py

Example - Encoding/Decoding JSON format

Source code

#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include "encrypt.h"

using namespace std;

int main() {
 	// std::string msg = "HELLO WORLD";
 	std::string msg = "{\"id\":1,\"method\":\"service.subscribe\",\"params\":[\"myapp/0.1c\", null,\"0.0.0.0\",\"80\"]}";
 	std::string key = "THISISMYKEY";
 	std::cout << "  message to send: " << msg << std::endl;
 	std::string encrypted_msg = encrypt(msg, key);
 	std::cout << "encrypted message: " << encrypted_msg << std::endl;
 	std::string decrypted_msg = decrypt(encrypted_msg, key);
 	std::cout << "decrypted message: " << decrypted_msg << std::endl;
    return 0;
}

Output

  message to send: {"id":1,"method":"service.subscribe","params":["myapp/0.1c", null,"0.0.0.0","80"]}
encrypted message: X5g7wjjTllj1ItCxShWUb77PKJsfP VNMAB7VtqaLCccGTr0ijkjxqw0IutQvXfSFK4OKo8cnpD1Lge0pdMCZf0fqQ8bjjFjkNn1h pBtdwNJD==
decrypted message: {"id":1,"method":"service.subscribe","params":["myapp/0.1c", null,"0.0.0.0","80"]}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].