· 4 years ago · Mar 17, 2021, 10:48 PM
1/// Authorship - infinite authentication tool.
2/// Nikolay Valentinovich Repnitskiy - License: WTFPLv2+ (wtfpl.net)
3
4
5/* Version 5.1, 50-char multi-way functions, 1k-char keys. This is computational
6difficulty and super-flexibility in endless cryptographic evidence. (Publicly-
7verifiable authorized-only number modification.) Get a number only you modify--
8which anyone verifies. Proof & doc: github.com/compromise-evident/Authorship
9Please generate and publish a personal Authorship number before being subject to
10censorship or worse. This way the public can trust number ownership. And on the
11day you become a governmental threat, the public inquires about your well being
12after which--you modify your number. Given that only you can modify your number,
13and given that the public or verifying party is here-given the ability to verify
14your modification, we can rest assured that any further correspondence from you
15is not impersonation. Additionally, you can insert data, messages, links, & hash
16for any authentication event--meaning information source can be trusted. And all
17old numbers & public files can be permanently destroyed on verification. Always
18generate and publish extra numbers at once for backups. And backup before using.
19~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
21 Authorship.public files can be pasted to and downloaded from stikked.ch
22 Want to explore without entering randomness? Set testing_mode to true!
23
24~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 * Proof of life.
26 * User authentication.
27 * Canary update authentication.
28 * Data, author, and version control authentication.
29 * Unretentive suspend-able untraceable anonymous cryptocurrency
30 (publicly-verifiable authorized-only withdrawal/ownership hand-over.)
31 * Untraceable anonymous fair trade over any network
32 (cryptographic solution to the Prisoner’s Dilemma.)
33 * Group and military authorization.
34 * Animal theft management.
35 * Voter fraud prevention.
36~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 5 sample notes you may enter for the 80-character user message when modifying:
38
39Migrating to Authorship 7.0.0. My new # is mEt@Rn:7#`YAzaI'|_@MqE/w2>Jz"_L+
40
41This user is migrating to Authorship version 7 and their new number is included.
42Here, you are asked to manually create an Authorship.number text file using this
43new number, where you may include the version information for extra file safety.
44Super-flexibility means you can move to completely different foreign authorship
45systems or hot-swap functions with riddles of any subject and still have the old
46numbers running redundantly. You can detail instructions using this next sample:
47~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48See 9402B file: 57ca2df105eb0cc67ba134c559f8a6fa55c1ae609a8897385f2ca96d935d467a
49
50Here, the user included the sha256sum to a 9,402-byte file uploaded separately.
51That file is strongly tied to this user and may contain links to damaging leaks.
52~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53Give 2.0000000000000000000000000000000000000 to 3HrGZ%_Mvj0!Ca=SctS.r>"GJl3g6COc
54
55This user wants two coins subtracted from their number, and added to the number
56in the message. Numbers may have goods and ideas assigned to them in any ledger.
57~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58Ownership hand-over to 73sty(C%yowImHEn+Z#1vXjsh&vf9z"@
59
60And this user handed their modification authorization over to someone anonymous.
61The anonymous user privately generated a new number and shared it with the other
62party. This other party simply expressed that number in their message and those
63verifying the event overwrite the modified number with the number in the message
64meaning anything assigned to the number always belongs to them who can prove it.
65~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66Trading with Anon28849: a89TI^\i!#7Mv#'e8:/Mt]S}OQ74mS@y
67
68Finally, Alice had anonymously contacted Bob, inquiring to trade numbers. Both
69parties agreed and began modifying their numbers--pausing just before entering
70their user message. Once they have exchanged their NEW numbers, both insert the
71sample message where Alice trades with Bob's NEW number and Bob with hers. After
72finishing number modification, both their Authorship.public files are published.
73If both messages coincide, their numbers are overwritten with numbers from their
74user message. Otherwise both continue as usual with at least one party having to
75modify only to have no real effect. Trade is always either fair or nonexistent.
76This symmetric method immediately shows verifying parties which numbers to seek.
77~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78Authorship.number (Storage for their Authorship number, 32 B
79 updates as you verify their published files.)
80Authorship.public (Your events published, and theirs--downloaded. ~613 kB
81 This updates YOUR new number on THEIR device,
82 and updates THEIR new number on YOUR device.)
83Authorship.private (Dynamic storage for your one-time keys. Makes ~1.1 MB
84 file Authorship.public upon modification then
85 overwrites this with new functions and keys.)
86~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87How to run the program - Software package repositories for GNU+Linux operating
88systems have all the tools you can imagine. Open a terminal and use this command
89as root to install Geany and g++ on your computer: apt install geany g++ Geany
90is a fast & lightweight text editor and Integrated Development Environment where
91you can write and run code. g++ is the GNU compiler for C++ which allows written
92code to run. The compiler operates in the background and displays errors in your
93code as you will see in the lower Geany box. Make a new folder somewhere on your
94machine. Paste this code into Geany. For clarity in auditing, enable indentation
95guides: go to View >> Show Indentation Guides. Save the document as anything.cpp
96within the newly-created folder. Use these shortcuts to run the program: F9, F5.
97You may paste over this code with other .cpp files, or open a new tab & repeat.
98~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99How to make an executable with g++ - Save this program as anything.cpp, open a
100terminal, and type g++ then space. Drag & drop this saved file into the terminal
101and its directory will be appended to your pending entry. Click on the terminal
102and press enter. a.out now resides in the user directory, you may rename it to
103anything. To run that executable, simply drag and drop it into a terminal, then
104click on the terminal and press enter. Reminder: executable's effect-directory
105is the user directory on your machine, for example: /home/nikolay Enjoy. */
106
107#include <fstream>
108#include <iostream>
109using namespace std;
110
111int main() // |
112{ bool bulk_verification_efficiency = false; /* DEFAULT=FALSE ELSE NO PLAINTEXT FILES. Octet if broken > |
113 By default Authorship deals with files containing the standard 95 printable ASCII |
114 characters 32 to 126 (+13 & 10) allowing any user to visually observe all files
115 but more so--to share .public files as plaintext via paste bins like stikked.ch
116 For example, the implementation generates values 0 - 94 then adds 32 upon writing
117 to file. And subtracts 32 upon reading from file. All files are inter-compatible
118 given the bulk-verification variable is changed where needed. If true, characters
119 are not adjusted therefore number modification verification takes significantly
120 less time if processing bulk. All files but Authorship.number are affected.*/// |
121 bool testing_mode = false; /* DEFAULT=FALSE ELSE SKIPS MANUAL ENTRY OF RANDOM SEEDS. Fatal if broken > |
122 CAUTION:: if true, guessing randomness becomes less challenging. Use this mode if |
123 and only if you're experimenting with a fork then turn it back off when finished!
124 If true, creating numbers in bulk may yield clone batches due to Unix time.*/// |
125 bool sector_accident_detection = true; /* DEFAULT=TRUE ELSE NO FILE INTEGRITY TESTS. ~Fatal if broken > |
126 Program writes to disk, reads it back, and compares it to RAM. Fails on mismatch. |
127 All files are affected. Implement custom .number integrity tests for currencies.
128 This does not affect verification speed since that requires matching 32 char. */
129
130 cout << "\n(Authorship) - infinite authentication tool\n\n"
131
132 << "(1) Create - get a number only you can modify--which anyone can verify.\n"
133 << "(2) Modify - needs file Authorship.private. Creates Authorship.public.\n"
134 << "(3) Verify - needs their files Authorship.public (rename if needed) and\n"
135 << " Authorship.number (32 char you retain, create file if needed.)\n\n"
136
137 << "Backup files temporarily! Enter option: ";
138
139 int user_option; cin >> user_option;
140 ifstream in_stream;
141 ofstream out_stream;
142
143
144
145
146
147 //_____________________________________________________________________________________________________________________
148 //__________________________________________________GET_FIRST_NUMBER__________________________________________________/
149 if(user_option == 1)
150 { //Checks if files already exists.
151 bool existence_of_file_Authorship_number = false;
152 bool existence_of_file_Authorship_private = false;
153 in_stream.open("Authorship.number"); if(in_stream.fail() == false) {existence_of_file_Authorship_number = true;} in_stream.close();
154 in_stream.open("Authorship.private"); if(in_stream.fail() == false) {existence_of_file_Authorship_private = true;} in_stream.close();
155
156 if((existence_of_file_Authorship_number == true)
157 && (existence_of_file_Authorship_private == true))
158 {cout << "\nFiles Authorship.number and Authorship.private already exist.\n"; return 0;}
159
160 if(existence_of_file_Authorship_number == true) {cout << "\nFile Authorship.number already exists.\n"; return 0;}
161 if(existence_of_file_Authorship_private == true) {cout << "\nFile Authorship.private already exists.\n"; return 0;}
162
163 //Gets seeds for RNG.
164 unsigned int user_seeds[50] = {0};
165 if(testing_mode == false)
166 { //Gets 50 seeds from the user.
167 cout << "\nEnter a random 8-digit integer, repeat 50 times.\n\n";
168 for(int a = 0; a < 50; a++)
169 { if(a < 9) {cout << " " << (a + 1) << " of 50: ";} //Blank for aesthetics.
170 else {cout << (a + 1) << " of 50: ";}
171
172 //Gets and checks input.
173 cin >> user_seeds[a];
174 if((user_seeds[a] > 99999999) || (user_seeds[a] < 10000000)) {cout << "\nOut of bounds, try again.\n"; return 0;}
175 }
176 }
177 else
178 { //Fills seeds automatically (not secure, please turn off testing_mode.)
179 cout << "\nCAUTION: testing_mode is turned on! Use of these files is strongly discouraged!";
180 srand(time(0));
181 for(int a = 0; a < 50; a++) {user_seeds[a] = (rand() % 100000000);}
182 }
183
184 cout << "\n\nWait 5 seconds...\n";
185
186 /*Generates random numbers in arrays functions[] and keys[]. (Constructively applies randomness based on 50 user seeds.)
187 Number of possible keys per key: (95^1,000 or 10^1977) ~= 529182274774504763830539013129828002031774783533315989172550112454325120067086
188 5320146452373594718852917306195312985394577376458207810856924643582943374082422747388708888747644424641359666528756626103165740624350564
189 7458352903136303750933244235717370788699695208239031166611256027967040028838334795356155711479538914638596550775005291039392481521230142
190 4866763813372856977497426768548229883133952014400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
191 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
192 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
193 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
194 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
195 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
196 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
197 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
198 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
199 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
200 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
201 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 */
202 unsigned char functions[50400] = {0}; //Eventually becomes 1,008 contiguous 50-character functions (encrypted.)
203 unsigned char keys [1008000] = {0}; //Immediately becomes 1,008 contiguous 1,000-character keys (used as seeds.)
204 for(int a = 0; a < 50; a++)
205 { srand(user_seeds[a]);
206
207 if((user_seeds[a] % 2) == 0)
208 { //Constructively fills functions[] and keys[] LEFT to right based on seeds.
209 for(int b = 0; b < 50400; b++)
210 { functions[b] += (rand() % 10);
211 functions[b] %= 10;
212 }
213
214 for(int b = 0; b < 1008000; b++)
215 { keys[b] += (rand() % 95);
216 keys[b] %= 95;
217 }
218 }
219 else
220 { //Constructively fills functions[] and keys[] RIGHT to left based on seeds.
221 for(int b = 50399; b >= 0; b--)
222 { functions[b] += (rand() % 10);
223 functions[b] %= 10;
224 }
225
226 for(int b = 1007999; b >= 0; b--)
227 { keys[b] += (rand() % 95);
228 keys[b] %= 95;
229 }
230 }
231 }
232
233 //Generates additional seeds from keys[] for additional transformation of actual_key[] before encryption.
234 long long secondary_seeds[100800] = {0}; //Assembles 100 (mostly 11-digit) seeds per key, from each of the 1,008 1,000-character keys.
235 int keys_read_bookmark = 0;
236 int secondary_seeds_write_bookmark = 0;
237 for(int a = 0; a < 100800; a++) //100,008 comes from 10 contiguous key characters being scraped at once, 100,800 times.
238 { for(int b = 0; b < 10; b++)
239 { secondary_seeds[secondary_seeds_write_bookmark] *= 10;
240 secondary_seeds[secondary_seeds_write_bookmark] += keys[keys_read_bookmark + b];
241 }
242
243 keys_read_bookmark += 10;
244 secondary_seeds_write_bookmark++;
245 }
246
247 //Generates 1,008 contiguous 50-digit plaintext (each composed of 10 contiguous 5-digit primes.)
248 bool sieve[100000] = {1, 1}; //Boolean sieve of Eratosthenes. Zeros are mapped to prime elements.
249 for(int prime = 2; prime < 317; prime++) //317 is sqrt(100,000)
250 { for(int a = prime + prime; a < 100000; a += prime) {sieve[a] = 1;}
251 }
252
253 int functions_read_bookmark = 0;
254 int functions_write_bookmark = 0;
255 for(int a = 0; a < 10080; a++) //50,400/5 = 10,080 total 5-digit primes.
256 { //Unloads 5 array elements to make one integer.
257 int temp_5_digit_prime;
258 temp_5_digit_prime = functions[functions_read_bookmark ]; if(temp_5_digit_prime == 0) {temp_5_digit_prime++;} temp_5_digit_prime *= 10;
259 temp_5_digit_prime += functions[functions_read_bookmark + 1]; temp_5_digit_prime *= 10;
260 temp_5_digit_prime += functions[functions_read_bookmark + 2]; temp_5_digit_prime *= 10;
261 temp_5_digit_prime += functions[functions_read_bookmark + 3]; temp_5_digit_prime *= 10;
262 temp_5_digit_prime += functions[functions_read_bookmark + 4];
263
264 //Adjusts temp_5_digit_prime for primality (tests & searches in pos dir.) If length > 5, sets to largest 5-digit prime.
265 while(sieve[temp_5_digit_prime] == 1)
266 { if(temp_5_digit_prime > 99991) {temp_5_digit_prime = 99991; break;}
267 temp_5_digit_prime++;
268 }
269
270 //Writes the prime to functions[].
271 functions[functions_write_bookmark + 4] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
272 functions[functions_write_bookmark + 3] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
273 functions[functions_write_bookmark + 2] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
274 functions[functions_write_bookmark + 1] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
275 functions[functions_write_bookmark ] = temp_5_digit_prime;
276
277 functions_read_bookmark += 5;
278 functions_write_bookmark += 5;
279 }
280
281 //Encrypts 1,008 plaintext to make the functions.
282 functions_write_bookmark = 0;
283 keys_read_bookmark = 0;
284 unsigned char actual_key[50] = {0};
285 int secondary_seeds_read_bookmark = 0;
286 for(int a = 0; a < 1008; a++) //Generates random numbers in array actual_key[].
287 { for(int b = 0; b < 1000; b++) //Constructively applies randomness based on keys[] (used as seeds, 1,000 items per actual_key[].)
288 { srand(keys[keys_read_bookmark]);
289
290 if((keys[keys_read_bookmark] % 2) == 0)
291 { for(int c = 0; c < 50; c++) //Fills left to right based on seeds.
292 { actual_key[c] += (rand() % 95);
293 actual_key[c] %= 95;
294 }
295 }
296 else
297 { for(int c = 49; c >= 0; c--) //Fills right to left based on seeds.
298 { actual_key[c] += (rand() % 95);
299 actual_key[c] %= 95;
300 }
301 }
302
303 keys_read_bookmark++;
304 }
305
306 //Further transforms actual_key[] based on secondary_seeds[].
307 for(int b = 0; b < 100; b++) //Constructively applies randomness based on secondary_seeds[] (used as seeds, 100 11-digit integer per actual_key[].)
308 { srand(secondary_seeds[secondary_seeds_read_bookmark]);
309
310 if((secondary_seeds[secondary_seeds_read_bookmark] % 2) == 0)
311 { for(int c = 0; c < 50; c++) //Fills left to right based on SECONDARY seeds.
312 { actual_key[c] += (rand() % 95);
313 actual_key[c] %= 95;
314 }
315 }
316 else
317 { for(int c = 49; c >= 0; c--) //Fills right to left based on SECONDARY seeds.
318 { actual_key[c] += (rand() % 95);
319 actual_key[c] %= 95;
320 }
321 }
322
323 secondary_seeds_read_bookmark++;
324 }
325
326 ///Encrypts functions[] using actual_key[].
327 for(int b = 0; b < 50; b++)
328 { functions[functions_write_bookmark] += actual_key[b];
329 functions[functions_write_bookmark] %= 95;
330
331 functions_write_bookmark++;
332 }
333
334 //Resetting actual key. If not reset (in option 3) then string depends on keys not present.
335 for(int a = 0; a < 50; a++) {actual_key[a] = 0;}
336 }
337
338 //Generates deductive lossy compression of the 1,008 functions.
339 long long deductive_lossy_compression[4]; //4 16-digit integers strung together, unique compression for each.
340 long long snapshots[4]; //Same but takes snapshots of compression, applies to compression after.
341 for(int a = 0; a < 4; a++) {deductive_lossy_compression[a] = 5555555555555555; snapshots[a] = 5555555555555555;}
342
343 for(int a = 0; a < 4; a++)
344 { for(int b = 0; b < 50400; b++)
345 { deductive_lossy_compression[a] += functions[b];
346 deductive_lossy_compression[a] *= (a + 2);
347 deductive_lossy_compression[a] %= 10000000000000000;
348
349 //Takes snapshots of the compression as it evolves over time.
350 if((b == 10000) || (b == 20000) || (b == 30000) || (b == 40000))
351 { snapshots[a] += deductive_lossy_compression[a];
352 snapshots[a] %= 10000000000000000;
353 }
354 }
355
356 //Applies snapshots to last stage of compression per integer.
357 deductive_lossy_compression[a] += snapshots[a];
358 deductive_lossy_compression[a] %= 10000000000000000;
359
360 //Ensures all 4 compression integers are 16 digits long.
361 if(deductive_lossy_compression[a] < 1000000000000000) {deductive_lossy_compression[a] += 1000000000000000;}
362 }
363
364 //Converts deductive_lossy_compression[] to 32 characters (1 char for every two contiguous digits.)
365 unsigned char number[32];
366 int number_write_bookmark = 0;
367
368 for(int a = 0; a < 4; a++)
369 { number[number_write_bookmark] = (deductive_lossy_compression[a] / 100000000000000); number_write_bookmark++;
370 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000000000) % 100); number_write_bookmark++;
371 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000000000) % 100); number_write_bookmark++;
372 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100000000) % 100); number_write_bookmark++;
373 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000) % 100); number_write_bookmark++;
374 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000) % 100); number_write_bookmark++;
375 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100) % 100); number_write_bookmark++;
376 number[number_write_bookmark] = (deductive_lossy_compression[a] % 100); number_write_bookmark++;
377 }
378
379 //Applies snapshots to the last character of the number.
380 for(int a = 0; a < 4; a++) {number[31] += (snapshots[a] % 100); number[31] %= 100;}
381
382 //Fixes number, it is now complete.
383 //Collisions via brute-force is futile; inputs are well-tested for additional properties therefore 32 char
384 //is over-kill indeed. 94^32 = 1380674536088650126365233338290905239051505147118049339937652736 or ~10^64.
385 for(int a = 0; a < 32; a++)
386 { if(number[a] == 0) {number[a]++;} //Ensures no spaces.
387 if(number[a] > 94) {number[a] -= 94;} //Ensures no values > 94.
388 }
389
390 //Writes number to file Authorship.number.
391 out_stream.open("Authorship.number");
392 for(int a = 0; a < 32; a++) {out_stream.put(number[a] + 32);}
393 out_stream.close();
394
395 //Writes functions and keys to file Authorship.private.
396 functions_read_bookmark = 0;
397 keys_read_bookmark = 0;
398 out_stream.open("Authorship.private");
399 out_stream << "DO NOT PUBLISH! Authorship.private v5.1.0=\r\n\r\n"; //46-byte header must be. Use "\r\n" for all returns (for max compatibility.)
400 if(bulk_verification_efficiency == false)
401 { for(int a = 0; a < 50400; a++) {out_stream.put(functions[a] + 32);} out_stream << "\r\n";
402 for(int a = 0; a < 1008000; a++) {out_stream.put(keys[a] + 32);}
403 }
404 else
405 { for(int a = 0; a < 50400; a++) {out_stream.put(functions[a]);} out_stream << "\r\n";
406 for(int a = 0; a < 1008000; a++) {out_stream.put(keys[a]);}
407 }
408 out_stream.close();
409
410 //Tests file integrity. This entire if-statement can be removed.
411 if(sector_accident_detection == true)
412 { char temp_file_byte;
413 bool sector_accident = false;
414
415 //Tests file Authorship.number.
416 in_stream.open("Authorship.number");
417 for(int a = 0; a < 32; a++)
418 { in_stream.get(temp_file_byte);
419 if((temp_file_byte - 32) != number[a]) {sector_accident = true; break;}
420 }
421 in_stream.close();
422
423 //Tests file Authorship.private.
424 in_stream.open("Authorship.private");
425 for(int a = 0; a < 46; a++) {in_stream.get(temp_file_byte);} //As the 46-byte headers can change, they are skipped.
426
427 //...For functions.
428 if(bulk_verification_efficiency == false)
429 { for(int a = 0; a < 50400; a++)
430 { in_stream.get(temp_file_byte);
431 if((temp_file_byte - 32) != functions[a]) {sector_accident = true; break;}
432 }
433 }
434 else
435 { for(int a = 0; a < 50400; a++)
436 { in_stream.get(temp_file_byte);
437 if((temp_file_byte) != functions[a]) {sector_accident = true; break;}
438 }
439 }
440
441 //...For return carriage and new line after functions. temp_file_byte not adjusted; "\r\n" was written regardless of bulk_verification_efficiency.
442 in_stream.get(temp_file_byte); //Tests if '\r' exists at the end of 1,008 functions.
443 if(temp_file_byte != '\r') {sector_accident = true;}
444 in_stream.get(temp_file_byte); //Tests if '\n' exists after the 'r'.
445 if(temp_file_byte != '\n') {sector_accident = true;}
446
447 //...For keys.
448 if(bulk_verification_efficiency == false)
449 { for(int a = 0; a < 1008000; a++)
450 { in_stream.get(temp_file_byte);
451 if((temp_file_byte - 32) != keys[a]) {sector_accident = true; break;}
452 }
453 }
454 else
455 { for(int a = 0; a < 1008000; a++)
456 { in_stream.get(temp_file_byte);
457 if((temp_file_byte) != keys[a]) {sector_accident = true; break;}
458 }
459 }
460 in_stream.close();
461
462 if(sector_accident == true)
463 { remove("Authorship.number");
464 remove("Authorship.private");
465
466 cout << "\n\n\nBad sectors! There's something wrong with your storage device.\n\n"
467
468 << "For a quick fix, fill your storage device with a few gigabytes worth of any\n"
469 << "data then try this again. And do not disturb that dummy data as its purpose\n"
470 << "is to consume bad sectors and abused parts of the storage device.\n\n";
471
472 return 0;
473 }
474 }
475
476 //Overwrites RAM of arrays: unsigned int user_seeds[50] and unsigned char actual_key[50].
477 for(int a = 0; a < 50; a++)
478 { user_seeds[a] = 0; user_seeds[a] = 12345678; user_seeds[a] = 87654321; user_seeds[a] = 99999999;
479 actual_key[a] = 0; actual_key[a] = 255;
480 }
481
482 //Overwrites RAM of array: unsigned char keys[1008000].
483 for(int a = 0; a < 1008000; a++) {keys[a] = 0; keys[a] = 255;}
484
485 cout << "\n\nPublish the contents of Authorship.number (32 characters.)\n"
486 << "Please include the Authorship version used, and your name or tag.\n"
487 << "(Not needed once published; verifying parties update it as you modify.)\n"
488 << "Guardedly cache Authorship.private. It contains dynamic one-time data.\n\n";
489 }
490
491
492
493
494
495 //_____________________________________________________________________________________________________________________
496 //____________________________________________________MODIFY_NUMBER___________________________________________________/
497 else if(user_option == 2)
498 { /* Basic layout:
499
500 1. Loads Authorship.private file.
501 2. Overwrites Authorship.private file with new info.
502 3. Displays user's new number and user enters or omits a message of up to 80 characters.
503 4. Selectively writes that old private info to a new .public file so as to symbolize the new number and message from the previous step.
504
505 You can modify using a private file created with bulk_verification_efficiency ON or OFF.
506 Your new private file, however, is still affected by that boolean variable. */
507
508 //Checks if file Authorship.private is present.
509 in_stream.open("Authorship.private");
510 if(in_stream.fail() == true)
511 { in_stream.close();
512
513 cout << "\nAuthorship.private is missing or misspelled. Copy and paste it into the\n"
514 << "folder from which you run this Authorship program. If this is an executable file\n"
515 << "running in the terminal, its effectiveness-directory is the user folder on this\n"
516 << "machine such as: /home/nikolay--where Authorship.private should be placed.\n"
517 << "Continue? y/n: ";
518
519 char wait;
520 cin >> wait;
521 if(wait != 'y') {return 0;}
522 }
523 in_stream.close();
524
525 in_stream.open("Authorship.private");
526 if(in_stream.fail() == true) {in_stream.close(); cout << "\nCannot continue without Authorship.private, program ended.\n"; return 0;}
527 char sniffed_one_file_character_Authorship_private;
528 in_stream.get(sniffed_one_file_character_Authorship_private);
529 if(in_stream.eof() == true) {in_stream.close(); cout << "\nAuthorship.private is empty, program ended.\n"; return 0;}
530 in_stream.close();
531
532 //Loads file Authorship.private. bulk_verification_efficiency is dormant here; bytes will be written (selectively) just as read-in.
533 char old_functions[50400];
534 char old_keys [1008000];
535 char header_waste;
536 in_stream.open("Authorship.private");
537 for(int a = 0; a < 46; a++) {in_stream.get(header_waste);} //Skips through the 46-character header.
538 for(int a = 0; a < 50400; a++) {in_stream.get(old_functions[a]);}
539 in_stream.get(header_waste); in_stream.get(header_waste); //Skips the "\r\n" characters after the 1,008 functions.
540 for(int a = 0; a < 1008000; a++) {in_stream.get(old_keys[a]);}
541 in_stream.close();
542
543
544
545
546
547 //The following block-bunch is a perfect snippet of option 1 except no managing of number FILE in any way (not used here.)
548 //Gets seeds for RNG.
549 unsigned int user_seeds[50] = {0};
550 if(testing_mode == false)
551 { //Gets 50 seeds from the user.
552 cout << "\nEnter a random 8-digit integer, repeat 50 times.\n\n";
553 for(int a = 0; a < 50; a++)
554 { if(a < 9) {cout << " " << (a + 1) << " of 50: ";} //Blank for aesthetics.
555 else {cout << (a + 1) << " of 50: ";}
556
557 //Gets and checks input.
558 cin >> user_seeds[a];
559 if((user_seeds[a] > 99999999) || (user_seeds[a] < 10000000)) {cout << "\nOut of bounds, try again.\n"; return 0;}
560 }
561 }
562 else
563 { //Fills seeds automatically (not secure, please turn off testing_mode.)
564 cout << "\nCAUTION: testing_mode is turned on! Use of these files is strongly discouraged!";
565 srand(time(0));
566 for(int a = 0; a < 50; a++) {user_seeds[a] = (rand() % 100000000);}
567 }
568
569 cout << "\n\nWait 5 seconds...\n";
570
571 /*Generates random numbers in arrays functions[] and keys[]. (Constructively applies randomness based on 50 user seeds.)
572 Number of possible keys per key: (95^1,000 or 10^1977) ~= 529182274774504763830539013129828002031774783533315989172550112454325120067086
573 5320146452373594718852917306195312985394577376458207810856924643582943374082422747388708888747644424641359666528756626103165740624350564
574 7458352903136303750933244235717370788699695208239031166611256027967040028838334795356155711479538914638596550775005291039392481521230142
575 4866763813372856977497426768548229883133952014400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
576 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
577 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
578 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
579 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
580 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
581 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
582 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
583 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
584 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
585 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
586 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 */
587 unsigned char functions[50400] = {0}; //Eventually becomes 1,008 contiguous 50-character functions (encrypted.)
588 unsigned char keys [1008000] = {0}; //Immediately becomes 1,008 contiguous 1,000-character keys (used as seeds.)
589 for(int a = 0; a < 50; a++)
590 { srand(user_seeds[a]);
591
592 if((user_seeds[a] % 2) == 0)
593 { //Constructively fills functions[] and keys[] LEFT to right based on seeds.
594 for(int b = 0; b < 50400; b++)
595 { functions[b] += (rand() % 10);
596 functions[b] %= 10;
597 }
598
599 for(int b = 0; b < 1008000; b++)
600 { keys[b] += (rand() % 95);
601 keys[b] %= 95;
602 }
603 }
604 else
605 { //Constructively fills functions[] and keys[] RIGHT to left based on seeds.
606 for(int b = 50399; b >= 0; b--)
607 { functions[b] += (rand() % 10);
608 functions[b] %= 10;
609 }
610
611 for(int b = 1007999; b >= 0; b--)
612 { keys[b] += (rand() % 95);
613 keys[b] %= 95;
614 }
615 }
616 }
617
618 //Generates additional seeds from keys[] for additional transformation of actual_key[] before encryption.
619 long long secondary_seeds[100800] = {0}; //Assembles 100 (mostly 11-digit) seeds per key, from each of the 1,008 1,000-character keys.
620 int keys_read_bookmark = 0;
621 int secondary_seeds_write_bookmark = 0;
622 for(int a = 0; a < 100800; a++) //100,008 comes from 10 contiguous key characters being scraped at once, 100,800 times.
623 { for(int b = 0; b < 10; b++)
624 { secondary_seeds[secondary_seeds_write_bookmark] *= 10;
625 secondary_seeds[secondary_seeds_write_bookmark] += keys[keys_read_bookmark + b];
626 }
627
628 keys_read_bookmark += 10;
629 secondary_seeds_write_bookmark++;
630 }
631
632 //Generates 1,008 contiguous 50-digit plaintext (each composed of 10 contiguous 5-digit primes.)
633 bool sieve[100000] = {1, 1}; //Boolean sieve of Eratosthenes. Zeros are mapped to prime elements.
634 for(int prime = 2; prime < 317; prime++) //317 is sqrt(100,000)
635 { for(int a = prime + prime; a < 100000; a += prime) {sieve[a] = 1;}
636 }
637
638 int functions_read_bookmark = 0;
639 int functions_write_bookmark = 0;
640 for(int a = 0; a < 10080; a++) //50,400/5 = 10,080 total 5-digit primes.
641 { //Unloads 5 array elements to make one integer.
642 int temp_5_digit_prime;
643 temp_5_digit_prime = functions[functions_read_bookmark ]; if(temp_5_digit_prime == 0) {temp_5_digit_prime++;} temp_5_digit_prime *= 10;
644 temp_5_digit_prime += functions[functions_read_bookmark + 1]; temp_5_digit_prime *= 10;
645 temp_5_digit_prime += functions[functions_read_bookmark + 2]; temp_5_digit_prime *= 10;
646 temp_5_digit_prime += functions[functions_read_bookmark + 3]; temp_5_digit_prime *= 10;
647 temp_5_digit_prime += functions[functions_read_bookmark + 4];
648
649 //Adjusts temp_5_digit_prime for primality (tests & searches in pos dir.) If length > 5, sets to largest 5-digit prime.
650 while(sieve[temp_5_digit_prime] == 1)
651 { if(temp_5_digit_prime > 99991) {temp_5_digit_prime = 99991; break;}
652 temp_5_digit_prime++;
653 }
654
655 //Writes the prime to functions[].
656 functions[functions_write_bookmark + 4] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
657 functions[functions_write_bookmark + 3] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
658 functions[functions_write_bookmark + 2] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
659 functions[functions_write_bookmark + 1] = (temp_5_digit_prime % 10); temp_5_digit_prime /= 10;
660 functions[functions_write_bookmark ] = temp_5_digit_prime;
661
662 functions_read_bookmark += 5;
663 functions_write_bookmark += 5;
664 }
665
666 //Encrypts 1,008 plaintext to make the functions.
667 functions_write_bookmark = 0;
668 keys_read_bookmark = 0;
669 unsigned char actual_key[50] = {0};
670 int secondary_seeds_read_bookmark = 0;
671 for(int a = 0; a < 1008; a++) //Generates random numbers in array actual_key[].
672 { for(int b = 0; b < 1000; b++) //Constructively applies randomness based on keys[] (used as seeds, 1,000 items per actual_key[].)
673 { srand(keys[keys_read_bookmark]);
674
675 if((keys[keys_read_bookmark] % 2) == 0)
676 { for(int c = 0; c < 50; c++) //Fills left to right based on seeds.
677 { actual_key[c] += (rand() % 95);
678 actual_key[c] %= 95;
679 }
680 }
681 else
682 { for(int c = 49; c >= 0; c--) //Fills right to left based on seeds.
683 { actual_key[c] += (rand() % 95);
684 actual_key[c] %= 95;
685 }
686 }
687
688 keys_read_bookmark++;
689 }
690
691 //Further transforms actual_key[] based on secondary_seeds[].
692 for(int b = 0; b < 100; b++) //Constructively applies randomness based on secondary_seeds[] (used as seeds, 100 11-digit integer per actual_key[].)
693 { srand(secondary_seeds[secondary_seeds_read_bookmark]);
694
695 if((secondary_seeds[secondary_seeds_read_bookmark] % 2) == 0)
696 { for(int c = 0; c < 50; c++) //Fills left to right based on SECONDARY seeds.
697 { actual_key[c] += (rand() % 95);
698 actual_key[c] %= 95;
699 }
700 }
701 else
702 { for(int c = 49; c >= 0; c--) //Fills right to left based on SECONDARY seeds.
703 { actual_key[c] += (rand() % 95);
704 actual_key[c] %= 95;
705 }
706 }
707
708 secondary_seeds_read_bookmark++;
709 }
710
711 ///Encrypts functions[] using actual_key[].
712 for(int b = 0; b < 50; b++)
713 { functions[functions_write_bookmark] += actual_key[b];
714 functions[functions_write_bookmark] %= 95;
715
716 functions_write_bookmark++;
717 }
718
719 //Resetting actual key. If not reset (in option 3) then string depends on keys not present.
720 for(int a = 0; a < 50; a++) {actual_key[a] = 0;}
721 }
722
723 //Generates deductive lossy compression of the 1,008 functions.
724 long long deductive_lossy_compression[4]; //4 16-digit integers strung together, unique compression for each.
725 long long snapshots[4]; //Same but takes snapshots of compression, applies to compression after.
726 for(int a = 0; a < 4; a++) {deductive_lossy_compression[a] = 5555555555555555; snapshots[a] = 5555555555555555;}
727
728 for(int a = 0; a < 4; a++)
729 { for(int b = 0; b < 50400; b++)
730 { deductive_lossy_compression[a] += functions[b];
731 deductive_lossy_compression[a] *= (a + 2);
732 deductive_lossy_compression[a] %= 10000000000000000;
733
734 //Takes snapshots of the compression as it evolves over time.
735 if((b == 10000) || (b == 20000) || (b == 30000) || (b == 40000))
736 { snapshots[a] += deductive_lossy_compression[a];
737 snapshots[a] %= 10000000000000000;
738 }
739 }
740
741 //Applies snapshots to last stage of compression per integer.
742 deductive_lossy_compression[a] += snapshots[a];
743 deductive_lossy_compression[a] %= 10000000000000000;
744
745 //Ensures all 4 compression integers are 16 digits long.
746 if(deductive_lossy_compression[a] < 1000000000000000) {deductive_lossy_compression[a] += 1000000000000000;}
747 }
748
749 //Converts deductive_lossy_compression[] to 32 characters (1 char for every two contiguous digits.)
750 unsigned char number[32];
751 int number_write_bookmark = 0;
752
753 for(int a = 0; a < 4; a++)
754 { number[number_write_bookmark] = (deductive_lossy_compression[a] / 100000000000000); number_write_bookmark++;
755 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000000000) % 100); number_write_bookmark++;
756 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000000000) % 100); number_write_bookmark++;
757 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100000000) % 100); number_write_bookmark++;
758 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000) % 100); number_write_bookmark++;
759 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000) % 100); number_write_bookmark++;
760 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100) % 100); number_write_bookmark++;
761 number[number_write_bookmark] = (deductive_lossy_compression[a] % 100); number_write_bookmark++;
762 }
763
764 //Applies snapshots to the last character of the number.
765 for(int a = 0; a < 4; a++) {number[31] += (snapshots[a] % 100); number[31] %= 100;}
766
767 //Fixes number, it is now complete.
768 //Collisions via brute-force is futile; inputs are well-tested for additional properties therefore 32 char
769 //is over-kill indeed. 94^32 = 1380674536088650126365233338290905239051505147118049339937652736 or ~10^64.
770 for(int a = 0; a < 32; a++)
771 { if(number[a] == 0) {number[a]++;} //Ensures no spaces.
772 if(number[a] > 94) {number[a] -= 94;} //Ensures no values > 94.
773 }
774
775 //Writes functions and keys to file Authorship.private.
776 functions_read_bookmark = 0;
777 keys_read_bookmark = 0;
778 out_stream.open("Authorship.private");
779 out_stream << "DO NOT PUBLISH! Authorship.private v5.1.0=\r\n\r\n"; //46-byte header must be. Use "\r\n" for all returns (for max compatibility.)
780 if(bulk_verification_efficiency == false)
781 { for(int a = 0; a < 50400; a++) {out_stream.put(functions[a] + 32);} out_stream << "\r\n";
782 for(int a = 0; a < 1008000; a++) {out_stream.put(keys[a] + 32);}
783 }
784 else
785 { for(int a = 0; a < 50400; a++) {out_stream.put(functions[a]);} out_stream << "\r\n";
786 for(int a = 0; a < 1008000; a++) {out_stream.put(keys[a]);}
787 }
788 out_stream.close();
789
790 //Tests file integrity. This entire if-statement can be removed.
791 if(sector_accident_detection == true)
792 { char temp_file_byte;
793 bool sector_accident = false;
794
795 //Tests file Authorship.private.
796 in_stream.open("Authorship.private");
797 for(int a = 0; a < 46; a++) {in_stream.get(temp_file_byte);} //As the 46-byte headers can change, they are skipped.
798
799 //...For functions.
800 if(bulk_verification_efficiency == false)
801 { for(int a = 0; a < 50400; a++)
802 { in_stream.get(temp_file_byte);
803 if((temp_file_byte - 32) != functions[a]) {sector_accident = true; break;}
804 }
805 }
806 else
807 { for(int a = 0; a < 50400; a++)
808 { in_stream.get(temp_file_byte);
809 if((temp_file_byte) != functions[a]) {sector_accident = true; break;}
810 }
811 }
812
813 //...For return carriage and new line after functions. temp_file_byte not adjusted; "\r\n" was written regardless of bulk_verification_efficiency.
814 in_stream.get(temp_file_byte); //Tests if '\r' exists at the end of 1,008 functions.
815 if(temp_file_byte != '\r') {sector_accident = true;}
816 in_stream.get(temp_file_byte); //Tests if '\n' exists after the 'r'.
817 if(temp_file_byte != '\n') {sector_accident = true;}
818
819 //...For keys.
820 if(bulk_verification_efficiency == false)
821 { for(int a = 0; a < 1008000; a++)
822 { in_stream.get(temp_file_byte);
823 if((temp_file_byte - 32) != keys[a]) {sector_accident = true; break;}
824 }
825 }
826 else
827 { for(int a = 0; a < 1008000; a++)
828 { in_stream.get(temp_file_byte);
829 if((temp_file_byte) != keys[a]) {sector_accident = true; break;}
830 }
831 }
832 in_stream.close();
833
834 if(sector_accident == true)
835 { remove("Authorship.private");
836
837 cout << "\n\n\nBad sectors! There's something wrong with your storage device.\n\n"
838
839 << "For a quick fix, fill your storage device with a few gigabytes worth of any\n"
840 << "data then try this again. And do not disturb that dummy data as its purpose\n"
841 << "is to consume bad sectors and abused parts of the storage device.\n\n";
842
843 return 0;
844 }
845 }
846
847 //Overwrites RAM of arrays: unsigned int user_seeds[50] and unsigned char actual_key[50].
848 for(int a = 0; a < 50; a++)
849 { user_seeds[a] = 0; user_seeds[a] = 12345678; user_seeds[a] = 87654321; user_seeds[a] = 99999999;
850 actual_key[a] = 0; actual_key[a] = 255;
851 }
852
853 //Overwrites RAM of array: unsigned char keys[1008000].
854 for(int a = 0; a < 1008000; a++) {keys[a] = 0; keys[a] = 255;}
855
856
857
858
859
860 //Prints number and gets the user's message.
861 cout << "\n\nYour new number is "; for(int a = 0; a < 32; a++) {cout << char(number[a] + 32);} cout << " (needed only for trade.)\n";
862 cout << "Notes included in this event will be extracted as plaintext upon verification.\n"
863 << "Enter a message (80 characters max; width of terminal) otherwise press enter:\n\n";
864 char nothing_to_see_here[1]; //Catching cached new line. GNU+Linux does not perform auto-clearing of char input, the "enter" you pressed just
865 cin.getline(nothing_to_see_here, 1); //before this is eaten by the next available cin.getline(), in this case--by variable nothing_to_see_here.
866
867 char message[10000] = {'\0'}; //Now that the new line is caught, message[] can safely eat actual typed characters.
868 cin.getline(message, 10000); //Init to '\0' sets remaining to null, this line will not do that on its own after input!
869
870 /*The following table shows symbol assignment. Every contiguous 9 functions in the list of 1,008 represent characters or no_char.
871 Recall that 5/9 of all special strings of 9 are always "1" so as to prevent ambiguity through clever selective censorship.
872
873 Nine functions Represents
874 1 = solved number & Standard
875 ref 0 = unsolved message ASCII
876 ______________________________________________
877 # 1 0 0 0 0 1 1 1 1 1 32
878 # 2 0 0 0 1 0 1 1 1 1 ! 33
879 # 3 0 0 0 1 1 0 1 1 1 " 34
880 # 4 0 0 0 1 1 1 0 1 1 # 35
881 # 5 0 0 0 1 1 1 1 0 1 $ 36
882 # 6 0 0 0 1 1 1 1 1 0 % 37
883 # 7 0 0 1 0 0 1 1 1 1 & 38
884 # 8 0 0 1 0 1 0 1 1 1 ' 39
885 # 9 0 0 1 0 1 1 0 1 1 ( 40
886 # 10 0 0 1 0 1 1 1 0 1 ) 41
887 # 11 0 0 1 0 1 1 1 1 0 * 42
888 # 12 0 0 1 1 0 0 1 1 1 + 43
889 # 13 0 0 1 1 0 1 0 1 1 , 44
890 # 14 0 0 1 1 0 1 1 0 1 - 45
891 # 15 0 0 1 1 0 1 1 1 0 . 46
892 # 16 0 0 1 1 1 0 0 1 1 / 47
893 # 17 0 0 1 1 1 0 1 0 1 0 48
894 # 18 0 0 1 1 1 0 1 1 0 1 49
895 # 19 0 0 1 1 1 1 0 0 1 2 50
896 # 20 0 0 1 1 1 1 0 1 0 3 51
897 # 21 0 0 1 1 1 1 1 0 0 4 52
898 # 22 0 1 0 0 0 1 1 1 1 5 53
899 # 23 0 1 0 0 1 0 1 1 1 6 54
900 # 24 0 1 0 0 1 1 0 1 1 7 55
901 # 25 0 1 0 0 1 1 1 0 1 8 56
902 # 26 0 1 0 0 1 1 1 1 0 9 57
903 # 27 0 1 0 1 0 0 1 1 1 : 58
904 # 28 0 1 0 1 0 1 0 1 1 ; 59
905 # 29 0 1 0 1 0 1 1 0 1 < 60
906 # 30 0 1 0 1 0 1 1 1 0 = 61
907 # 31 0 1 0 1 1 0 0 1 1 > 62
908 # 32 0 1 0 1 1 0 1 0 1 ? 63
909 # 33 0 1 0 1 1 0 1 1 0 @ 64
910 # 34 0 1 0 1 1 1 0 0 1 A 65
911 # 35 0 1 0 1 1 1 0 1 0 B 66
912 # 36 0 1 0 1 1 1 1 0 0 C 67
913 # 37 0 1 1 0 0 0 1 1 1 D 68
914 # 38 0 1 1 0 0 1 0 1 1 E 69
915 # 39 0 1 1 0 0 1 1 0 1 F 70
916 # 40 0 1 1 0 0 1 1 1 0 G 71
917 # 41 0 1 1 0 1 0 0 1 1 H 72
918 # 42 0 1 1 0 1 0 1 0 1 I 73
919 # 43 0 1 1 0 1 0 1 1 0 J 74
920 # 44 0 1 1 0 1 1 0 0 1 K 75
921 # 45 0 1 1 0 1 1 0 1 0 L 76
922 # 46 0 1 1 0 1 1 1 0 0 M 77
923 # 47 0 1 1 1 0 0 0 1 1 N 78
924 # 48 0 1 1 1 0 0 1 0 1 O 79
925 # 49 0 1 1 1 0 0 1 1 0 P 80
926 # 50 0 1 1 1 0 1 0 0 1 Q 81
927 # 51 0 1 1 1 0 1 0 1 0 R 82
928 # 52 0 1 1 1 0 1 1 0 0 S 83
929 # 53 0 1 1 1 1 0 0 0 1 T 84
930 # 54 0 1 1 1 1 0 0 1 0 U 85
931 # 55 0 1 1 1 1 0 1 0 0 V 86
932 # 56 0 1 1 1 1 1 0 0 0 W 87
933 # 57 1 0 0 0 0 1 1 1 1 X 88
934 # 58 1 0 0 0 1 0 1 1 1 Y 89
935 # 59 1 0 0 0 1 1 0 1 1 Z 90
936 # 60 1 0 0 0 1 1 1 0 1 [ 91
937 # 61 1 0 0 0 1 1 1 1 0 \ 92
938 # 62 1 0 0 1 0 0 1 1 1 ] 93
939 # 63 1 0 0 1 0 1 0 1 1 ^ 94
940 # 64 1 0 0 1 0 1 1 0 1 _ 95
941 # 65 1 0 0 1 0 1 1 1 0 ` 96
942 # 66 1 0 0 1 1 0 0 1 1 a 97
943 # 67 1 0 0 1 1 0 1 0 1 b 98
944 # 68 1 0 0 1 1 0 1 1 0 c 99
945 # 69 1 0 0 1 1 1 0 0 1 d 100
946 # 70 1 0 0 1 1 1 0 1 0 e 101
947 # 71 1 0 0 1 1 1 1 0 0 f 102
948 # 72 1 0 1 0 0 0 1 1 1 g 103
949 # 73 1 0 1 0 0 1 0 1 1 h 104
950 # 74 1 0 1 0 0 1 1 0 1 i 105
951 # 75 1 0 1 0 0 1 1 1 0 j 106
952 # 76 1 0 1 0 1 0 0 1 1 k 107
953 # 77 1 0 1 0 1 0 1 0 1 l 108
954 # 78 1 0 1 0 1 0 1 1 0 m 109
955 # 79 1 0 1 0 1 1 0 0 1 n 110
956 # 80 1 0 1 0 1 1 0 1 0 o 111
957 # 81 1 0 1 0 1 1 1 0 0 p 112
958 # 82 1 0 1 1 0 0 0 1 1 q 113
959 # 83 1 0 1 1 0 0 1 0 1 r 114
960 # 84 1 0 1 1 0 0 1 1 0 s 115
961 # 85 1 0 1 1 0 1 0 0 1 t 116
962 # 86 1 0 1 1 0 1 0 1 0 u 117
963 # 87 1 0 1 1 0 1 1 0 0 v 118
964 # 88 1 0 1 1 1 0 0 0 1 w 119
965 # 89 1 0 1 1 1 0 0 1 0 x 120
966 # 90 1 0 1 1 1 0 1 0 0 y 121
967 # 91 1 0 1 1 1 1 0 0 0 z 122
968 # 92 1 1 0 0 0 0 1 1 1 { 123
969 # 93 1 1 0 0 0 1 0 1 1 | 124
970 # 94 1 1 0 0 0 1 1 0 1 } 125
971 # 95 1 1 0 0 0 1 1 1 0 ~ 126
972 # 96 1 1 0 0 1 0 0 1 1 no_char
973 # 97 1 1 0 0 1 0 1 0 1 unassigned
974 # 98 1 1 0 0 1 0 1 1 0 unassigned
975 # 99 1 1 0 0 1 1 0 0 1 unassigned
976 #100 1 1 0 0 1 1 0 1 0 unassigned
977 #101 1 1 0 0 1 1 1 0 0 unassigned
978 #102 1 1 0 1 0 0 0 1 1 unassigned
979 #103 1 1 0 1 0 0 1 0 1 unassigned
980 #104 1 1 0 1 0 0 1 1 0 unassigned
981 #105 1 1 0 1 0 1 0 0 1 unassigned
982 #106 1 1 0 1 0 1 0 1 0 unassigned
983 #107 1 1 0 1 0 1 1 0 0 unassigned
984 #108 1 1 0 1 1 0 0 0 1 unassigned
985 #109 1 1 0 1 1 0 0 1 0 unassigned
986 #110 1 1 0 1 1 0 1 0 0 unassigned
987 #111 1 1 0 1 1 1 0 0 0 unassigned
988 #112 1 1 1 0 0 0 0 1 1 unassigned
989 #113 1 1 1 0 0 0 1 0 1 unassigned
990 #114 1 1 1 0 0 0 1 1 0 unassigned
991 #115 1 1 1 0 0 1 0 0 1 unassigned
992 #116 1 1 1 0 0 1 0 1 0 unassigned
993 #117 1 1 1 0 0 1 1 0 0 unassigned
994 #118 1 1 1 0 1 0 0 0 1 unassigned
995 #119 1 1 1 0 1 0 0 1 0 unassigned
996 #120 1 1 1 0 1 0 1 0 0 unassigned
997 #121 1 1 1 0 1 1 0 0 0 unassigned
998 #122 1 1 1 1 0 0 0 0 1 unassigned
999 #123 1 1 1 1 0 0 0 1 0 unassigned
1000 #124 1 1 1 1 0 0 1 0 0 unassigned
1001 #125 1 1 1 1 0 1 0 0 0 unassigned
1002 #126 1 1 1 1 1 0 0 0 0 unassigned
1003
1004 Combination 96 (reference # 96) is repeated for all remaining contiguous nine functions if no user message exists.
1005 For messages shorter than 80 characters, remaining unused spaces are also filled with combination 96 = 1 1 0 0 1 0 0 1 1
1006 since it is vital that exactly 5 of every contiguous 9 functions are solved befor they give any meaning, even if no_char.
1007 (Combination 96 (no_char) is a custom assignment in the Authorship program. It is NOT the null character.) */
1008
1009 //Concatenates new number and message.
1010 char cat[112]; //There are 112 groups of 9 functions.
1011 for(int a = 0; a < 32; a++) {cat[a] = (number[a] + 32);} //Puts in new number.
1012 for(int a = 32; a < 112; a++) {cat[a] = message[a - 32];} //Appends user message.
1013
1014 //Creates a binary determinant for selective key-writing based on the new number & message (to Authorship.public file.) Last else-if = no_char.
1015 bool b[1008]; //b for binary.
1016 int m = 0; //m for write_bookMark for b[].
1017 bool failed_first_entry = false;
1018
1019 for(int a = 0; a < 112; a++) // 1 2 3 4 5 6 7 8 9
1020 { // | | | | | | | | |
1021 if(cat[a] == ' ') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1022 else if(cat[a] == '!') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1023 else if(cat[a] == '"') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1024 else if(cat[a] == '#') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1025 else if(cat[a] == '$') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1026 else if(cat[a] == '%') {b[m]= 0; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1027 else if(cat[a] == '&') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1028 else if(cat[a] =='\'') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1029 else if(cat[a] == '(') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1030 else if(cat[a] == ')') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1031 else if(cat[a] == '*') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1032 else if(cat[a] == '+') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1033 else if(cat[a] == ',') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1034 else if(cat[a] == '-') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1035 else if(cat[a] == '.') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1036 else if(cat[a] == '/') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1037 else if(cat[a] == '0') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1038 else if(cat[a] == '1') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1039 else if(cat[a] == '2') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1040 else if(cat[a] == '3') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1041 else if(cat[a] == '4') {b[m]= 0; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1042 else if(cat[a] == '5') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1043 else if(cat[a] == '6') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1044 else if(cat[a] == '7') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1045 else if(cat[a] == '8') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1046 else if(cat[a] == '9') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1047 else if(cat[a] == ':') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1048 else if(cat[a] == ';') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1049 else if(cat[a] == '<') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1050 else if(cat[a] == '=') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1051 else if(cat[a] == '>') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1052 else if(cat[a] == '?') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1053 else if(cat[a] == '@') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1054 else if(cat[a] == 'A') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1055 else if(cat[a] == 'B') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1056 else if(cat[a] == 'C') {b[m]= 0; b[m+1]= 1; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1057 else if(cat[a] == 'D') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1058 else if(cat[a] == 'E') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1059 else if(cat[a] == 'F') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1060 else if(cat[a] == 'G') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1061 else if(cat[a] == 'H') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1062 else if(cat[a] == 'I') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1063 else if(cat[a] == 'J') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1064 else if(cat[a] == 'K') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1065 else if(cat[a] == 'L') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1066 else if(cat[a] == 'M') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1067 else if(cat[a] == 'N') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1068 else if(cat[a] == 'O') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1069 else if(cat[a] == 'P') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1070 else if(cat[a] == 'Q') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1071 else if(cat[a] == 'R') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1072 else if(cat[a] == 'S') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1073 else if(cat[a] == 'T') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1074 else if(cat[a] == 'U') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1075 else if(cat[a] == 'V') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1076 else if(cat[a] == 'W') {b[m]= 0; b[m+1]= 1; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 0;}
1077 else if(cat[a] == 'X') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1078 else if(cat[a] == 'Y') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1079 else if(cat[a] == 'Z') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1080 else if(cat[a] == '[') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1081 else if(cat[a] =='\\') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1082 else if(cat[a] == ']') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1083 else if(cat[a] == '^') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1084 else if(cat[a] == '_') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1085 else if(cat[a] == '`') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1086 else if(cat[a] == 'a') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1087 else if(cat[a] == 'b') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1088 else if(cat[a] == 'c') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1089 else if(cat[a] == 'd') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1090 else if(cat[a] == 'e') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1091 else if(cat[a] == 'f') {b[m]= 1; b[m+1]= 0; b[m+2]= 0; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1092 else if(cat[a] == 'g') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1093 else if(cat[a] == 'h') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1094 else if(cat[a] == 'i') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1095 else if(cat[a] == 'j') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1096 else if(cat[a] == 'k') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1097 else if(cat[a] == 'l') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1098 else if(cat[a] == 'm') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1099 else if(cat[a] == 'n') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1100 else if(cat[a] == 'o') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1101 else if(cat[a] == 'p') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 0; b[m+4]= 1; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1102 else if(cat[a] == 'q') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1103 else if(cat[a] == 'r') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1104 else if(cat[a] == 's') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1105 else if(cat[a] == 't') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1106 else if(cat[a] == 'u') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1107 else if(cat[a] == 'v') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1108 else if(cat[a] == 'w') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 0; b[m+8]= 1;}
1109 else if(cat[a] == 'x') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 0;}
1110 else if(cat[a] == 'y') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 0; b[m+6]= 1; b[m+7]= 0; b[m+8]= 0;}
1111 else if(cat[a] == 'z') {b[m]= 1; b[m+1]= 0; b[m+2]= 1; b[m+3]= 1; b[m+4]= 1; b[m+5]= 1; b[m+6]= 0; b[m+7]= 0; b[m+8]= 0;}
1112 else if(cat[a] == '{') {b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 0; b[m+6]= 1; b[m+7]= 1; b[m+8]= 1;}
1113 else if(cat[a] == '|') {b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1114 else if(cat[a] == '}') {b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 0; b[m+8]= 1;}
1115 else if(cat[a] == '~') {b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 0; b[m+5]= 1; b[m+6]= 1; b[m+7]= 1; b[m+8]= 0;}
1116 else if(cat[a] =='\0') {b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1;}
1117 // | | | | | | | | |
1118 // 1 2 3 4 5 6 7 8 9
1119
1120 else
1121 { if(failed_first_entry == false) {cout << "\nYou hit an F-key / arrow-key while typing. Try again:\n";}
1122 else {cout << "\nTry again. For no message, press enter:\n";}
1123
1124 failed_first_entry = true;
1125
1126 for(int a = 0; a < 10000; a++) {message[a] = '\0';} //Resets message[].
1127 cin.getline(message, 10000); //Has been RESET to null, this line will not do that on its own after input!
1128 a = -1; //Restarts this assignment loop (-1 because a++ occurs again before for() compares.)
1129 m = 0; //Resetting bookmark for b[].
1130
1131 //Concatenates new number and message (again.)
1132 for(int a = 0; a < 32; a++) {cat[a] = (number[a] + 32);} //Puts in new number.
1133 for(int a = 32; a < 112; a++) {cat[a] = message[a - 32];} //Appends user message.
1134
1135 continue;
1136 }
1137
1138 m += 9;
1139 }
1140
1141 //Notifies user if no message entered ("Ctrl + something" on terminal input will do weird things so user
1142 //is essentially informed that verifying parties will see "user omitted a message" upon verification.)
1143 //Or just authenticate when your cat is AFK.
1144 if(message[0] == '\0')
1145 { cout << "\nNo message accepted.\n";
1146
1147 //Unnecessary but ensures all message symbols are no_char (reference #96) due to weird "Ctrl + something" entries. This way,
1148 //all characters after no_char (if any) are set to no_char to eliminate (closely examined) artifacting for serious events.
1149 m = 288; //32 * 9 = 288 functions already used for the number; sets bookmark to beginning of message (289th.)
1150 for(int a = 0; a < 80; a++)
1151 { b[m]= 1; b[m+1]= 1; b[m+2]= 0; b[m+3]= 0; b[m+4]= 1; b[m+5]= 0; b[m+6]= 0; b[m+7]= 1; b[m+8]= 1; m+=9;
1152 } // | | | | | | | | |
1153 }
1154
1155 //Creates file Authorship.public, writes all old functions, and selectively writes old keys.
1156 //In this file, you'll see two columns. Left one is all functions, and the right one--keys to the corresponding functions.
1157 //The first 288 functions (32 groups of 9 contiguous) are for representing the new 32-character number. And the remaining
1158 //720 functions (80 groups of 9 contiguous) are for representing the 80-character user message for that authentication event.
1159 char sector_accident_reference[612976]; //Writing to this as well as to file for matching upon integrity test. For every .put(),
1160 //sector_accident_reference gets it too if sector_accident_detection == true. Compiler optimizes and goes for it without checking.
1161 int sector_accident_reference_write_bookmark = 0;
1162 int old_functions_read_bookmark = 0;
1163 int old_keys_read_bookmark = 0;
1164
1165 out_stream.open("Authorship.public");
1166 out_stream << "Authorship.public v5.1.0=\r\n\r\n"; //29-byte header must be. Use "\r\n" for all returns (for max compatibility.)
1167 for(int a = 0; a < 1008; a++)
1168 { //Writes function.
1169 for(int b = 0; b < 50; b++)
1170 { out_stream.put(old_functions[old_functions_read_bookmark]);
1171 if(sector_accident_detection == true)
1172 {sector_accident_reference[sector_accident_reference_write_bookmark] = old_functions[old_functions_read_bookmark];}
1173
1174 old_functions_read_bookmark++;
1175 sector_accident_reference_write_bookmark++;
1176 }
1177
1178 ///Writes key if b[] == 1.
1179 if(b[a] == 1)
1180 { out_stream.put(' ');
1181 if(sector_accident_detection == true)
1182 {sector_accident_reference[sector_accident_reference_write_bookmark] = ' '; sector_accident_reference_write_bookmark++;}
1183
1184 for(int b = 0; b < 1000; b++)
1185 { out_stream.put(old_keys[old_keys_read_bookmark]);
1186 if(sector_accident_detection == true)
1187 {sector_accident_reference[sector_accident_reference_write_bookmark] = old_keys[old_keys_read_bookmark];}
1188
1189 old_keys_read_bookmark++;
1190 sector_accident_reference_write_bookmark++;
1191 }
1192
1193 out_stream << "\r\n";
1194 if(sector_accident_detection == true)
1195 { sector_accident_reference[sector_accident_reference_write_bookmark] = '\r'; sector_accident_reference_write_bookmark++;
1196 sector_accident_reference[sector_accident_reference_write_bookmark] = '\n'; sector_accident_reference_write_bookmark++;
1197 }
1198 }
1199 else
1200 { //###################################################
1201 //##=` `=##
1202 old_keys_read_bookmark += 1000; //
1203 //##=_ _=##
1204 //###################################################
1205
1206
1207 out_stream << "\r\n";
1208 if(sector_accident_detection == true)
1209 { sector_accident_reference[sector_accident_reference_write_bookmark] = '\r'; sector_accident_reference_write_bookmark++;
1210 sector_accident_reference[sector_accident_reference_write_bookmark] = '\n'; sector_accident_reference_write_bookmark++;
1211 }
1212 }
1213 }
1214 out_stream.close();
1215
1216 //Tests file integrity. This entire if-statement can be removed.
1217 if(sector_accident_detection == true)
1218 { char temp_file_byte;
1219 bool sector_accident = false;
1220 in_stream.open("Authorship.public");
1221 for(int a = 0; a < 29; a++) {in_stream.get(temp_file_byte);} //As the 29-byte headers can change, they are skipped.
1222 for(int a = 0; a < 612976; a++) //Size = (613,005 - 29 header).
1223 { in_stream.get(temp_file_byte);
1224 if(temp_file_byte != sector_accident_reference[a]) {sector_accident = true; break;}
1225 }
1226 in_stream.close();
1227
1228 if(sector_accident == true)
1229 { remove("Authorship.private");
1230 remove("Authorship.public");
1231
1232 cout << "\n\n\nBad sectors! There's something wrong with your storage device.\n\n"
1233
1234 << "For a quick fix, fill your storage device with a few gigabytes worth of any\n"
1235 << "data then try this again. And do not disturb that dummy data as its purpose\n"
1236 << "is to consume bad sectors and abused parts of the storage device.\n\n";
1237
1238 return 0;
1239 }
1240 }
1241
1242 //Overwrites RAM of array: (signed) char old_keys[50400].
1243 for(int a = 0; a < 1008000; a++) {old_keys[a] = 0; old_keys[a] = -1;}
1244
1245 cout << "\nAuthorship.private is updated, cache it guardedly and destroy the old copy.\n"
1246 << "Publish Authorship.public. Once verified the file needs not exist anywhere.";
1247 }
1248
1249
1250
1251
1252
1253 //_____________________________________________________________________________________________________________________
1254 //_____________________________________________VERIFY_NUMBER_MODIFICATION_____________________________________________/
1255 else if(user_option == 3)
1256 { /* Basic layout:
1257
1258 1. Loads files Authorship.public and Authorship.number.
1259 2. Compares a deductive lossy compression of all public file functions to the number in the number file.
1260 3. Extracts the new number & message based on missing solutions, solves functions to which keys are present.
1261 4. Overwrites file Authorship.number with the new number--a fingerprint of another function list not yet public. */
1262
1263 //Checks if BOTH files Authorship.number and Authorship.public are present.
1264 bool presence_of_file_Authorship_number = false;
1265 bool presence_of_file_Authorship_public = false;
1266 in_stream.open("Authorship.number"); if(in_stream.fail() == false) {presence_of_file_Authorship_number = true;} in_stream.close();
1267 in_stream.open("Authorship.public"); if(in_stream.fail() == false) {presence_of_file_Authorship_public = true;} in_stream.close();
1268 if((presence_of_file_Authorship_number == false)
1269 && (presence_of_file_Authorship_public == false))
1270 { cout << "\nBoth files are missing. If this is an executable file running in the terminal,\n"
1271 << "its effectiveness-directory is the user folder, for example: /home/nikolay\n";
1272 return 0;
1273 }
1274 if(presence_of_file_Authorship_number == false)
1275 { cout << "\nAuthorship.number is missing. If this is an executable file running in the\n"
1276 << "terminal, its effectiveness-directory is the user folder such as /home/nikolay\n";
1277 return 0;
1278 }
1279 if(presence_of_file_Authorship_public == false)
1280 { cout << "\nAuthorship.public is missing. If this is an executable file running in the\n"
1281 << "terminal, its effectiveness-directory is the user folder such as /home/nikolay\n";
1282 return 0;
1283 }
1284
1285 //Checks if BOTH files Authorship.number and Authorship.public are empty.
1286 bool existence_of_substance_in_file_Authorship_number = false;
1287 bool existence_of_substance_in_file_Authorship_public = false;
1288 char sniffed_one_file_character;
1289
1290 in_stream.open("Authorship.number");
1291 in_stream.get(sniffed_one_file_character);
1292 if(in_stream.eof() == false) {existence_of_substance_in_file_Authorship_number = true;}
1293 in_stream.close();
1294 in_stream.open("Authorship.public");
1295 in_stream.get(sniffed_one_file_character);
1296 if(in_stream.eof() == false) {existence_of_substance_in_file_Authorship_public = true;}
1297 in_stream.close();
1298
1299 if((existence_of_substance_in_file_Authorship_number == false)
1300 && (existence_of_substance_in_file_Authorship_public == false))
1301 { cout << "\nBoth files are empty.\n";
1302 return 0;
1303 }
1304 if(existence_of_substance_in_file_Authorship_number == false) {cout << "\nAuthorship.number is empty.\n"; return 0;}
1305 if(existence_of_substance_in_file_Authorship_public == false) {cout << "\nAuthorship.public is empty.\n"; return 0;}
1306
1307 //Loads file Authorship.public and places functions and keys in different batches.
1308 char functions[50400]; //1,008 50-character functions.
1309 char keys [560000]; //560,000 = (560 of 1,008 present keys * 1,000 characters in length). Comes from (560,000 key characters * (5/9)).
1310 int functions_write_bookmark = 0;
1311 int keys_write_bookmark = 0;
1312 bool b[1008] = {0}; //b for binary, logs presence and absence of keys.
1313
1314 in_stream.open("Authorship.public");
1315 char temp_file_byte; for(int a = 0; a < 29; a++) {in_stream.get(temp_file_byte);} //As the 29-byte headers can change, they are skipped.
1316 for(int a = 0; a < 1008; a++) //Grabbing 1,568 items (1,008 functions + 560 keys.)
1317 { //Gets function.
1318 for(int b = 0; b < 50; b++)
1319 { in_stream.get(functions[functions_write_bookmark]);
1320 functions_write_bookmark++;
1321 }
1322
1323 //Gets key if present.
1324 in_stream.get(temp_file_byte); //Checks what's after the function.
1325 if(temp_file_byte == ' ')
1326 { b[a] = 1; //1 = key present.
1327 for(int c = 0; c < 1000; c++)
1328 { in_stream.get(keys[keys_write_bookmark]);
1329 keys_write_bookmark++;
1330 }
1331
1332 in_stream.get(temp_file_byte); //Skips '\r'.
1333 in_stream.get(temp_file_byte); //Skips '\n'.
1334 }
1335 else
1336 { in_stream.get(temp_file_byte); //Skips '\n' from the "\r\n" after function.
1337 }
1338 }
1339 in_stream.close();
1340
1341 //Adjusts functions[] and keys[] if bulk_verification_efficiency is off (default.)
1342 if(bulk_verification_efficiency == false)
1343 { for(int a = 0; a < 50400; a++) {functions[a] -= 32;}
1344 for(int a = 0; a < 560000; a++) { keys[a] -= 32;}
1345 }
1346
1347 //Generates deductive lossy compression of the 1,008 functions.
1348 long long deductive_lossy_compression[4]; //4 16-digit integers strung together, unique compression for each.
1349 long long snapshots[4]; //Same but takes snapshots of compression, applies to compression after.
1350 for(int a = 0; a < 4; a++) {deductive_lossy_compression[a] = 5555555555555555; snapshots[a] = 5555555555555555;}
1351
1352 for(int a = 0; a < 4; a++)
1353 { for(int b = 0; b < 50400; b++)
1354 { deductive_lossy_compression[a] += functions[b];
1355 deductive_lossy_compression[a] *= (a + 2);
1356 deductive_lossy_compression[a] %= 10000000000000000;
1357
1358 //Takes snapshots of the compression as it evolves over time.
1359 if((b == 10000) || (b == 20000) || (b == 30000) || (b == 40000))
1360 { snapshots[a] += deductive_lossy_compression[a];
1361 snapshots[a] %= 10000000000000000;
1362 }
1363 }
1364
1365 //Applies snapshots to last stage of compression per integer.
1366 deductive_lossy_compression[a] += snapshots[a];
1367 deductive_lossy_compression[a] %= 10000000000000000;
1368
1369 //Ensures all 4 compression integers are 16 digits long.
1370 if(deductive_lossy_compression[a] < 1000000000000000) {deductive_lossy_compression[a] += 1000000000000000;}
1371 }
1372
1373 //Converts deductive_lossy_compression[] to 32 characters (1 char for every two contiguous digits.)
1374 unsigned char number[32];
1375 int number_write_bookmark = 0;
1376
1377 for(int a = 0; a < 4; a++)
1378 { number[number_write_bookmark] = (deductive_lossy_compression[a] / 100000000000000); number_write_bookmark++;
1379 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000000000) % 100); number_write_bookmark++;
1380 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000000000) % 100); number_write_bookmark++;
1381 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100000000) % 100); number_write_bookmark++;
1382 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 1000000) % 100); number_write_bookmark++;
1383 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 10000) % 100); number_write_bookmark++;
1384 number[number_write_bookmark] = ((deductive_lossy_compression[a] / 100) % 100); number_write_bookmark++;
1385 number[number_write_bookmark] = (deductive_lossy_compression[a] % 100); number_write_bookmark++;
1386 }
1387
1388 //Applies snapshots to the last character of the number.
1389 for(int a = 0; a < 4; a++) {number[31] += (snapshots[a] % 100); number[31] %= 100;}
1390
1391 //Fixes number, it is now complete.
1392 //Collisions via brute-force is futile; inputs are well-tested for additional properties therefore 32 char
1393 //is over-kill indeed. 94^32 = 1380674536088650126365233338290905239051505147118049339937652736 or ~10^64.
1394 for(int a = 0; a < 32; a++)
1395 { if(number[a] == 0) {number[a]++;} //Ensures no spaces.
1396 if(number[a] > 94) {number[a] -= 94;} //Ensures no values > 94.
1397 }
1398
1399 //Compares the function deductive lossy compression (number) with the number on file--belonging to the modifying party.
1400 in_stream.open("Authorship.number");
1401 for(int a = 0; a < 32; a++)
1402 { in_stream.get(temp_file_byte);
1403 if((number[a] + 32) != temp_file_byte)
1404 { cout << "\nFAILED! Number decompression did not produce the given public functions.\n";
1405 return 0;
1406 }
1407 }
1408 in_stream.close();
1409
1410 //Extracts the new number and user message based on the symbolism of key presence and absence. First if = no_char.
1411 //This step in its nature simultaneously checks that there are strictly 5 keys for every group of 9 contiguous functions.
1412 char cat[112]; //Concatenation of 32-character number and 80-character message.
1413 int m = 0; //m for read_bookMark for b[].
1414 for(int a = 0; a < 112; a++)
1415 {
1416 // 1 2 3 4 5 6 7 8 9 Extracted
1417 // | | | | | | | | | character
1418 if((b[m]== 1 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]='\0';}
1419 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= ' ';}
1420 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '!';}
1421 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '"';}
1422 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '#';}
1423 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '$';}
1424 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '%';}
1425 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '&';}
1426 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]='\'';}
1427 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '(';}
1428 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= ')';}
1429 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '*';}
1430 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '+';}
1431 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= ',';}
1432 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '-';}
1433 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '.';}
1434 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '/';}
1435 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '0';}
1436 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '1';}
1437 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '2';}
1438 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '3';}
1439 else if((b[m]== 0 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= '4';}
1440 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '5';}
1441 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '6';}
1442 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '7';}
1443 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '8';}
1444 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '9';}
1445 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= ':';}
1446 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= ';';}
1447 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '<';}
1448 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '=';}
1449 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '>';}
1450 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '?';}
1451 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '@';}
1452 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'A';}
1453 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'B';}
1454 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'C';}
1455 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'D';}
1456 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'E';}
1457 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'F';}
1458 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'G';}
1459 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'H';}
1460 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'I';}
1461 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'J';}
1462 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'K';}
1463 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'L';}
1464 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'M';}
1465 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'N';}
1466 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'O';}
1467 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'P';}
1468 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'Q';}
1469 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'R';}
1470 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'S';}
1471 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'T';}
1472 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'U';}
1473 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'V';}
1474 else if((b[m]== 0 )&&(b[m+1]== 1 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'W';}
1475 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'X';}
1476 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'Y';}
1477 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'Z';}
1478 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '[';}
1479 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]='\\';}
1480 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= ']';}
1481 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '^';}
1482 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '_';}
1483 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '`';}
1484 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'a';}
1485 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'b';}
1486 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'c';}
1487 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'd';}
1488 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'e';}
1489 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 0 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'f';}
1490 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'g';}
1491 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'h';}
1492 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'i';}
1493 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'j';}
1494 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'k';}
1495 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'l';}
1496 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'm';}
1497 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'n';}
1498 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'o';}
1499 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 0 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'p';}
1500 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= 'q';}
1501 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'r';}
1502 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 's';}
1503 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 't';}
1504 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'u';}
1505 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'v';}
1506 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= 'w';}
1507 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= 'x';}
1508 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'y';}
1509 else if((b[m]== 1 )&&(b[m+1]== 0 )&&(b[m+2]== 1 )&&(b[m+3]== 1 )&&(b[m+4]== 1 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 0 )&&(b[m+8]== 0 )) {cat[a]= 'z';}
1510 else if((b[m]== 1 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 0 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '{';}
1511 else if((b[m]== 1 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 0 )&&(b[m+7]== 1 )&&(b[m+8]== 1 )) {cat[a]= '|';}
1512 else if((b[m]== 1 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 0 )&&(b[m+8]== 1 )) {cat[a]= '}';}
1513 else if((b[m]== 1 )&&(b[m+1]== 1 )&&(b[m+2]== 0 )&&(b[m+3]== 0 )&&(b[m+4]== 0 )&&(b[m+5]== 1 )&&(b[m+6]== 1 )&&(b[m+7]== 1 )&&(b[m+8]== 0 )) {cat[a]= '~';}
1514 // | | | | | | | | |
1515 // 1 2 3 4 5 6 7 8 9
1516
1517 else {cout << "\nFailed! Symbolism not corresponding to assignment.\n"; return 0;}
1518
1519 m += 9;
1520 }
1521
1522 //Generates additional seeds from keys[] for additional transformation of actual_key[] before decryption.
1523 long long secondary_seeds[56000] = {0}; //Assembles 100 (mostly 11-digit) seeds per key, from each of the 560 1,000-character keys. (560 = 5/9 of 1,008.)
1524 int keys_read_bookmark = 0;
1525 int secondary_seeds_write_bookmark = 0;
1526 for(int a = 0; a < 56000; a++) //56,000 comes from 10 contiguous key characters being scraped at once, 56,000 times.
1527 { for(int b = 0; b < 10; b++)
1528 { secondary_seeds[secondary_seeds_write_bookmark] *= 10;
1529 secondary_seeds[secondary_seeds_write_bookmark] += keys[keys_read_bookmark + b];
1530 }
1531
1532 keys_read_bookmark += 10;
1533 secondary_seeds_write_bookmark++;
1534 }
1535
1536 //Turns keys into actual keys.
1537 keys_read_bookmark = 0;
1538 int write_back_actual_key_bookmark = 0;
1539 int secondary_seeds_read_bookmark = 0;
1540 unsigned char actual_key[50] = {0};
1541 for(int a = 0; a < 560; a++) //Generates random numbers in array actual_key[].
1542 { for(int b = 0; b < 1000; b++) //Constructively applies randomness based on keys[] (used as seeds, 1,000 items per actual_key[].)
1543 { srand(keys[keys_read_bookmark]);
1544
1545 if((keys[keys_read_bookmark] % 2) == 0)
1546 { for(int c = 0; c < 50; c++) //Fills left to right based on seeds.
1547 { actual_key[c] += (rand() % 95);
1548 actual_key[c] %= 95;
1549 }
1550 }
1551 else
1552 { for(int c = 49; c >= 0; c--) //Fills right to left based on seeds.
1553 { actual_key[c] += (rand() % 95);
1554 actual_key[c] %= 95;
1555 }
1556 }
1557
1558 keys_read_bookmark++;
1559 }
1560
1561 //Further transforms actual_key[] based on secondary_seeds[].
1562 for(int b = 0; b < 100; b++) //Constructively applies randomness based on secondary_seeds[] (used as seeds, 100 11-digit integer per actual_key[].)
1563 { srand(secondary_seeds[secondary_seeds_read_bookmark]);
1564
1565 if((secondary_seeds[secondary_seeds_read_bookmark] % 2) == 0)
1566 { for(int c = 0; c < 50; c++) //Fills left to right based on SECONDARY seeds.
1567 { actual_key[c] += (rand() % 95);
1568 actual_key[c] %= 95;
1569 }
1570 }
1571 else
1572 { for(int c = 49; c >= 0; c--) //Fills right to left based on SECONDARY seeds.
1573 { actual_key[c] += (rand() % 95);
1574 actual_key[c] %= 95;
1575 }
1576 }
1577
1578 secondary_seeds_read_bookmark++;
1579 }
1580
1581 //Writes the result back to keys[]. Only in Authorship option 3, the first 28,000 elements of keys[] is reused for temporary write-back of actual_key[].
1582 for(int d = 0; d < 50; d++)
1583 { keys[write_back_actual_key_bookmark] = actual_key[d];
1584 write_back_actual_key_bookmark++;
1585 }
1586
1587 //Resetting actual key. If not reset (in option 3) then string depends on keys not present.
1588 for(int a = 0; a < 50; a++) {actual_key[a] = 0;}
1589 }
1590
1591 //Decrypts 560 functions.
1592 keys_read_bookmark = 0;
1593 int functions_read_write_bookmark = 0;
1594 for(int a = 0; a < 1008; a++)
1595 { if(b[a] == 1)
1596 { /* ______________________________________________ ________________________________________________
1597 | | |
1598 | if key <= ciphertext | else |
1599 | then plaintext = (ciphertext - key) | plaintext = ((95 - key) + ciphertext) |
1600 |______________________________________________|________________________________________________|
1601 */
1602 for(int b = 0; b < 50; b++)
1603 { if(keys[keys_read_bookmark] <= functions[functions_read_write_bookmark])
1604 { functions[functions_read_write_bookmark] = (functions[functions_read_write_bookmark] - keys[keys_read_bookmark]);
1605
1606 //Checks if extracted plaintext is one digit. Never exceeds 99,999 upon later reconstruction from 5 elements.
1607 if(functions[functions_read_write_bookmark] > 9)
1608 { cout << "\nFailed! Plaintext properties don't satisfy search priorities.\n";
1609 return 0;
1610 }
1611 }
1612 else
1613 { functions[functions_read_write_bookmark] = ((95 - keys[keys_read_bookmark]) + functions[functions_read_write_bookmark]);
1614
1615 //Checks if extracted plaintext is one digit. Never exceeds 99,999 upon later reconstruction from 5 elements.
1616 if(functions[functions_read_write_bookmark] > 9)
1617 { cout << "\nFailed! Plaintext properties don't satisfy search priorities.\n";
1618 return 0;
1619 }
1620 }
1621
1622 keys_read_bookmark++;
1623 functions_read_write_bookmark++;
1624 }
1625 }
1626 else
1627 { //########################################################
1628 //##=` `=##
1629 functions_read_write_bookmark += 50; //
1630 //##= _ _=##
1631 //########################################################
1632 }
1633 }
1634
1635 //Checks if solved functions contain 10 unspecified 5-digit contiguous primes.
1636 //This means solutions are not mathematically inherent to a function hence no reversal shortcuts.
1637 bool sieve[100000] = {1, 1}; //Boolean sieve of Eratosthenes. Zeros are mapped to prime elements.
1638 for(int prime = 2; prime < 317; prime++) //317 is sqrt(100,000)
1639 { for(int a = prime + prime; a < 100000; a += prime) {sieve[a] = 1;}
1640 }
1641
1642 int functions_read_bookmark = 0;
1643 int search_priority_satisfaction = false;
1644 int solved_counter = 0;
1645 for(int a = 0; a < 1008; a++) //10 5-digit primes per function, 560 functions solved.
1646 { if(b[a] == 1)
1647 { for(int b = 0; b < 10; b++)
1648 { //Unloads 5 array elements to make one integer.
1649 int five_digit_prime;
1650 five_digit_prime = functions[functions_read_bookmark ]; five_digit_prime *= 10;
1651 five_digit_prime += functions[functions_read_bookmark + 1]; five_digit_prime *= 10;
1652 five_digit_prime += functions[functions_read_bookmark + 2]; five_digit_prime *= 10;
1653 five_digit_prime += functions[functions_read_bookmark + 3]; five_digit_prime *= 10;
1654 five_digit_prime += functions[functions_read_bookmark + 4];
1655
1656 //Tests for primality.
1657 if((five_digit_prime < 10007)
1658 || (sieve[five_digit_prime] != 0))
1659 { cout << "\nFailed! Plaintext properties don't satisfy search priorities.\n";
1660 return 0;
1661 }
1662
1663 functions_read_bookmark += 5;
1664 }
1665
1666 solved_counter++;
1667 }
1668 else
1669 { //###################################################
1670 //##=` `=##
1671 functions_read_bookmark += 50; //
1672 //##=_ _=##
1673 //###################################################
1674 }
1675
1676 search_priority_satisfaction++; //Must run 1,008 times.
1677 }
1678
1679 if((search_priority_satisfaction != 1008) || (solved_counter != 560))
1680 { cout << "\nFAILED! Could not test 560 of 1,008 functions.\n";
1681 return 0;
1682 }
1683
1684 //Updating file Authorship.number with the new number extracted from the symbolism of missing and present solutions.
1685 out_stream.open("Authorship.number");
1686 for(int a = 0; a < 32; a++) {out_stream.put(cat[a]);}
1687 out_stream.close();
1688
1689 //Tests file integrity. This entire if-statement can be removed.
1690 if(sector_accident_detection == true)
1691 { char temp_file_byte;
1692 bool sector_accident = false;
1693
1694 //Tests file Authorship.number.
1695 in_stream.open("Authorship.number");
1696 for(int a = 0; a < 32; a++)
1697 { in_stream.get(temp_file_byte);
1698 if((temp_file_byte) != cat[a]) {sector_accident = true; break;}
1699 }
1700 in_stream.close();
1701
1702 if(sector_accident == true)
1703 { remove("Authorship.number");
1704
1705 cout << "\n\n\nBad sectors! There's something wrong with your storage device.\n\n"
1706
1707 << "Verification may have been successful, but your drive could not retain the\n"
1708 << "user's new Authorship number. You must verify again to get that new number.\n"
1709 << "For a quick fix, fill your storage device with a few gigabytes worth of any\n"
1710 << "data then try this again. And do not disturb that dummy data as its purpose\n"
1711 << "is to consume bad sectors and abused parts of the storage device.\n\n";
1712
1713 return 0;
1714 }
1715 }
1716
1717 //Prints user's message if present for this event.
1718 cout << "\n\n\tVerification SUCCESSFUL!\n\n"
1719
1720 << "The number file has been overwritten with their new number.\n"
1721 << "You can discard any and all old modification information.\n";
1722
1723 if(cat[32] != '\0') //If 33rd item in cat[] is not no_char.
1724 { cout << "The user included a message for this authentication event: \n\n";
1725
1726 for(int a = 32; a < 112; a++) {cout << char(cat[a]);}
1727 cout << "\n";
1728 }
1729 else {cout << "The user omitted a message for this authentication event.\n";}
1730 }
1731
1732 else {cout << "\nInvalid option, program ended.\n"; return 0;}
1733}
1734