Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Maciel committed Jan 7, 2018
0 parents commit 3375531
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Decrypter 32-bits:

This program decrypts any message with 32-bit encryption, here are two
encrypted message examples:

Msg1: 96+!9?-?P,'"$90-=X#?#91?96#>P0+8<=0L55B."=4)

Key 1: 112 Key 2: 120 Key 3: 98 Key 4: 108

Msg2: >U():2*%>U/$_="5309A:&? _%9$)<85>U; -4K 24%)>

Key 1: 127 Key 2: 117 Key 3: 107 Key 4: 97

The process takes time, the time varies according to the speed of your
machine, so be patient.

# Authors:

Athos Rodrigues, Gustavo Maciel.
73 changes: 73 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>

// Msg1: 96+!9?-?P,'"$90-=X#?#91?96#>P0+8<=0L55B."=4
// Msg2: >U():2*%>U/$_="5309A:&? _%9$)<85>U; -4K 24%)>
/*1ª Mensagem: INIMIGOS TENTARAM ASSASSINAR HITLER EM BREVE
Chaves: Chave 1: 112 Chave 2: 120 Chave 3: 98 Chave 4: 108
Composição das chaves = 1886937708
2ª Mensagem: A CHEGADA DE HITLER ESTA PREVISTA PARA AMANHA
Chaves: Chave 1: 127 Chave 2: 117 Chave 3: 107 Chave 4: 97
Composição das chaves = 2138401633*/
using namespace std;

int main()
{
string data = "";
cout << "Note: Sometimes the application emits a beep, it's because of XOR, sometimes it can type \\a (make a beep) when prints to the screen" << endl;
cout << "Type the data, (must be 32 bits): ";
cin >> data;
char c[45] = {};
char toBeMatched[] = {"HITLER"};
bool end = false;
long longkey1, longkey2, longkey3, longkey4;

while (end == false) {
for (int key1 = 0; key1 < 256; key1++)
for (int key2 = 0; key2 < 256; key2++)
for (int key3 = 0; key3 < 256; key3++)
for (int key4 = 0; key4 < 256; key4++) {
for (int i = 0, j = 1, k = 2, l = 3; i < data.size() && j < data.size() && k < data.size() && l < data.size(); i = i + 4, j = j + 4, k = k + 4, l = l + 4) {
c[i] = data[i];
c[i] ^= key1;

c[j] = data[j];
c[j] ^= key2;

c[k] = data[k];
c[k] ^= key3;

c[l] = data[l];
c[l] ^= key4;
}
string msg(c);
if (strstr(c, toBeMatched)) {
cout << key1 << "-" << key2 << "-" << key3 << "-" << key4 << " = " << msg << endl;
longkey1 = key1;
longkey2 = key2;
longkey3 = key3;
longkey4 = key4;

longkey1 <<= 24;
longkey2 <<= 16;
longkey3 <<= 8;
longkey4 = longkey4;

cout << endl << "As chaves sao: " << "Chave 1: " << key1 << " Chave 2: " << key2 << " Chave 3: " << key3 << " Chave 4: " << key4;
cout << endl << "A chave e: " << longkey1 + longkey2 + longkey3 + longkey4 << endl;
system("pause");

}
else {
cout << key1 << "-" << key2 << "-" << key3 << "-" << key4 << " = " << msg << endl;
}
}
}
system("pause");
cout << endl;
cin.get();
return 0;
}
Binary file added main.exe
Binary file not shown.

0 comments on commit 3375531

Please sign in to comment.