From c1141bf596433a197e338435149c1da9055e5c87 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Mon, 29 Jul 2024 19:27:12 +0530 Subject: [PATCH] Added XOR operation in CRC code. TODO -> Add encoding function. NEED TO FIX -> XOR operation only works when the length of data and key is same. --- Codes/CRC.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Codes/CRC.cpp diff --git a/Codes/CRC.cpp b/Codes/CRC.cpp new file mode 100644 index 0000000..5d61e8c --- /dev/null +++ b/Codes/CRC.cpp @@ -0,0 +1,36 @@ +#include +#include +using namespace std; + + +string XOR(string data, string key) { + // Dividend is data + // Divisor is the primary key, i.e. the key + string result = ""; + int len = data.length(); + + // Performing XOR operation + for (int i=0; i