about summary refs log tree commit diff
path: root/encryption.hpp
diff options
context:
space:
mode:
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;
+}