-
Notifications
You must be signed in to change notification settings - Fork 1
/
algorithm_explanation.txt
139 lines (110 loc) · 7.02 KB
/
algorithm_explanation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
CASUALKRYPT V.03 ALGORITHM EXPLANATION
PEDRO MIGUEL SOSA
konukoii.com
Developer Email: [email protected]
-------------------------------<>
NOTES: a. When we speak of adding/subtracting/multiplying/dividing letters.
We refer to the idea that letters can be translated into ASCII characters that have a numeral value.
We are adding/sub/mul/div those numeral values together.
b. ASCII RANGE (32 - 126)
c. ASCII RANGE SIZE: 94
-------------------------------<>
ENCRYPTION Protocol:
1. PASSWORD CONVERSION:
a. Convert each letter of the password into ASCII and add it up into TAP (Total Ascii Password)
his is going to be the key from now on.
2. READ INPUT:
a. Open the file in Binary and read everything (until the EOF) inside it, and assing it to a string.
From now on this string will be refered to as "flow"
3. BASE 64 ENCODING:
a. Encode the string into base64.
This eliminates any random letter that escapes the basic ASCII range (ex: á,©,etc.)
This is important because when reading text from some binary files such as .exe or .jpg
there might not be a direct translation from what you are reading to ASCII
4. ANARCHY VECTOR ALGORITHM:
a. Divide the length of flow into packets.
Each packet consists of "n" characters; where n is equal to the lenght of the password
b. Switch packet places, by inverting pairs.
Ex:
Original Vector: (1 2) (3 4) (5 6) (7 8) (9)
| | | | | | | | |
Cyphered Vector: (2 1) (4 3) (6 5) (8 7) (9)
5. PASSWORD DISPLACEMENT:
a. We will randomly select a letter from flow that will range from 1 to (TAP%password.lenght())
b. We will add to this letter of flow the last letter of the password.
c. We shall check if this letter is within our ASCII Range upper limit.
If it is above we shall subtract 94 (the Range Size) from it, until it is within the ASCII RANGE
(Notice it cannot go under the range because there are no negative ascii values)
The idea behind this is that if someone breaks the header encryption and reverses the Basic CasualKrypt Algorithm
he still wont be able to decode in Base64 because of this ilegal charater.
6. MAIN CASUALKRYPT ALGORITHM:
a. We will loop create a loop that will check every character in the flow string.
b. Each character will be converted into its ASCII numeral counterpart
c. If the character is within ASCII Range we will proceed, else we will append to "cylines" without modification.
(Usually characters never are outside the ASCII Range, due to the b64 encryption.
But if it is turned off then this measure is necessary)
d. We will add this character to TAP and to N (N is the number of letters already processed).
e. If it is above the ASCII RANGE we shall subtract 94 (the Range Size) from it, until it is within the ASCII RANGE
(Notice it cannot go under the range because there are no negative ascii values)
f. We will add one to N and proceed to append this character to cylines (short for Cyphered Lines)
(The purpose of N is to make every character encryption unique. Otherwise all "a" would be the same [a+TAP])
g. We then will go on to the next character until we reach the end of the string flow.
7. Corrupt Header Creation:
a. We will randomly choose an amount of corrupt characters to add to the string "body" (corrupt header body)
This amount will be range from (1 to 11+Password.length())
b. The character will be randomly chosen from the ASCII RANGE and appended to the body
c. When all the random characters have been appended we will append a pointer.
This pointer is chosen by password[TAP%password.length()]
d. This whole corrupt header body will be appended to the beginning of cylines
8. OUTPUT FILE
we output the file with the user-defined output filename or with the default "Cyphered.txt"
9. REPEAT THIS ALGORITHM
Repeats much times as the user defined (option "-r") [default 2 times]
-------------------------------<>
DECRYPTION Protocol:
1. PASSWORD CONVERSION:
a. Convert each letter of the password into ASCII and add it up into TAP (Total Ascii Password)
his is going to be the key from now on.
2. READ INPUT:
a. Open the file in Binary and read everything (until the EOF) inside it, and assing it to a string.
From now on this string will be refered to as "cylines" (Cyphered Lines)
3. Corrupt Header Destruction:
a. We will calculate the pointer for this cyphered text by using:
password[TAP%password.length()]
b. We will now loop throught each character of cylines until we find the pointer.
c. When the pointer is found we will erase everything from the beginning of cylines to the pointer
(Effectivly eliminating the corrupt header)
4. MAIN CASUALKRYPT ALGORITHM:
a. We will loop create a loop that will check every character in the cylines string.
b. Each character will be converted into its ASCII numeral counterpart
c. If the character is within ASCII Range we will proceed, else we will append to "cylines" without modification.
(Usually characters never are outside the ASCII Range, due to the b64 encryption.
But if it is turned off then this measure is necessary)
d. We will subtract TAP and N (N is the number of letters already processed) from the selected character.
e. If it is below the ASCII Range we shall add 94 (the Range Size) from it, until it is within the ASCII RANGE
(Notice it cannot go over the range because there are no negative ascii values)
f. We will add one to N and proceed to append this character to cylines (short for Cyphered Lines)
(The purpose of N is to make every character encryption unique. Otherwise all "a" would be the same [a+TAP])
g. We then will go on to the next character until we reach the end of the string cylines.
5. PASSWORD DISPLACEMENT:
a. We will select the letter from cylines that is the Displaced Letter by using:
Displaced Number: 1+ (TAP%password.lenght())
b. We will subtract to this letter of flow the last letter of the password.
c. We shall check if this letter is within our ASCII Range lower limit.
If it is above we shall add 94 (the Range Size) from it, until it is within the ASCII RANGE
(Notice it cannot go under the range because there are no negative ascii values)
6. ANARCHY VECTOR ALGORITHM:
a. Divide the length of flow into packets.
Each packet consists of "n" characters; where n is equal to the lenght of the password
b. Switch packet places, by inverting pairs.
Ex:
Cyphered Vector: (2 1) (4 3) (6 5) (8 7) (9)
| | | | | | | | |
Original Vector: (1 2) (3 4) (5 6) (7 8) (9)
7. BASE 64 ENCODING:
a. Decode the string into base64.
This re-creates any random letter that escapes the basic ASCII range (ex: á,©,etc.)
8. OUTPUT FILE
we output the file with the user-defined output filename or with the default "Cyphered.txt"
9. REPEAT THIS ALGORITHM
Repeats much times as the user defined (option "-r") [default 2 times]