about summary refs log tree commit diff
path: root/encryption.hpp
diff options
context:
space:
mode:
authorUbuntu <baitinq@Peces.qluofd4gyjdubpy0ojfn3gxkic.bx.internal.cloudapp.net>2020-06-05 17:12:19 +0000
committerUbuntu <baitinq@Peces.qluofd4gyjdubpy0ojfn3gxkic.bx.internal.cloudapp.net>2020-06-05 17:12:19 +0000
commitc739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae (patch)
tree66fb3ec1af228082fab674e9aa98ba17d6b9cb44 /encryption.hpp
downloadencrypted-chat-master.tar.gz
encrypted-chat-master.tar.bz2
encrypted-chat-master.zip
Release HEAD master
Diffstat (limited to 'encryption.hpp')
-rw-r--r--encryption.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/encryption.hpp b/encryption.hpp
new file mode 100644
index 0000000..b8a1be4
--- /dev/null
+++ b/encryption.hpp
@@ -0,0 +1,38 @@
+#include <cstdio>
+#include <unistd.h>
+#include <cstring>
+#include <pthread.h>
+#include <termios.h>
+#include <vector>
+#include <algorithm>
+#include "structs.hpp"
+
+#define DEFAULT_PASS "default"
+
+int encrypt(Options* options, char* data, int size);
+int decrypt(Options* options, char* data, int size);
+
+/*
+ * 	CUSTOMIZE THIS TWO METHODS
+ *	
+ *	Currently using basic XOR example encryption
+ *	
+ */
+
+int encrypt(Options* options, char* data, int size)
+{
+	if(!options->encryption)
+		return 0;
+	
+	for(int i = 0; i < size; i++)
+		*(data + i) = *(data + i) ^ (int)options->password[0];
+
+	return 0;
+}
+
+int decrypt(Options* options, char* data, int size)
+{
+	encrypt(options, data, size);
+
+	return 0;
+}