-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumguess.cpp
1352 lines (1321 loc) · 34.6 KB
/
numguess.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <fstream>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <cmath>
#include <iostream>
#include <sstream>
using namespace std;
int PasswordNum(string key, bool first, int loop){
int loop_4 = (loop / 2);
char num;
int i_num;
int i_n;
int rem;
while(loop_4 > key.length()){
loop_4 = loop_4 - key.length();
}
num = key[loop_4];
i_num = (int)num;
if(first == false){
rem = i_num % 10;
i_num = i_num - rem;
i_num = (i_num / 10);
i_n = i_num;
}
if(first == true){
rem = i_num % 10;
i_n = rem;
}
return i_n;
}
string NumberGuess(int val, int key_val, int loop){
int top_val;
if(loop % 2 == 0){
top_val=320+loop+key_val;
val = val - key_val;
}
if(loop % 2 == 1){
top_val=320+loop-key_val;
val = val + key_val;
}
int bottom_val=0;
int guess;
string bin_val;
string higher_val="2";
string lower_val="1";
string equal_val="0";
bool correct = false;
while(correct == false){
guess = ((top_val + bottom_val)/2);
//cout << guess << endl;
if(guess == val){ // higher
bin_val += equal_val;
correct = true;
}
if(guess > val){ // higher
bin_val += higher_val;
top_val = guess;
}
if(guess < val){ // higher
bin_val += lower_val;
bottom_val = guess;
}
}
return bin_val;
}
string LoopBreaker(string password, string key_val){
string new_password;
string addition;
bool first = false;
char ch;
int i_ch;
int n;
for(int i=0; i<password.length(); i++){
n = PasswordNum(key_val, first, i);
ch = password[i];
i_ch = (int)ch;
addition = NumberGuess(i_ch, n, i);
new_password += addition;
first = !first;
}
return new_password;
}
string BoxScramble(string message){
string msg;
string full_msg;
int remi = message.length() % 15;
for(int i=0; i<message.length() - remi;){
msg = message[i+10];
msg += message[i+6];
msg += message[i]; // 2
msg += message[i+14];
msg += message[i+8]; // 4
msg += message[i+4];
msg += message[i+12];// 6
msg += message[i+7];
msg += message[i+2]; // 8
msg += message[i+3];
msg += message[i+9]; // 10
msg += message[i+13];
msg += message[i+1]; // 12
msg += message[i+5];
msg += message[i+11]; // 14
full_msg += msg;
i = i + 15;
}
int l = message.length() - remi;
for(int d=l; d<message.length(); d++){
msg = message[d];
full_msg += msg;
}
return full_msg;
}
string BoxUnScramble(string message){
string msg;
string full_msg;
int remi = message.length() % 15;
for(int i=0; i<message.length() - remi;){
msg = message[i+2];
msg += message[i+12];
msg += message[i+8]; // 2
msg += message[i+9];
msg += message[i+5]; // 4
msg += message[i+13];
msg += message[i+1];// 6
msg += message[i+7];
msg += message[i+4]; // 8
msg += message[i+10];
msg += message[i]; // 10
msg += message[i+14];
msg += message[i+6]; // 12
msg += message[i+11];
msg += message[i+3]; // 14
full_msg += msg;
i = i + 15;
}
int l = message.length() - remi;
for(int d=l; d<message.length(); d++){
msg = message[d];
full_msg += msg;
}
return full_msg;
}
string PrimeNumberEqual(int i){
string s_num;
string full_num;
int total;
string s_total;
string zero="0";
int two;
two = i % 2;
two = (1155 * two);
int three;
three = i % 3;
three = (385 * three);
int five;
five = i % 5;
five = (five * 77);
int seven;
seven = i % 7;
seven = (seven * 11);
int eleven;
eleven = i % 11;
total = two + three + five + seven + eleven;
//s_num = to_string(two);
//full_num += s_num;
//s_num = to_string(three);
//full_num += s_num;
//s_num = to_string(five);
//full_num += s_num;
//s_num = to_string(seven);
//full_num += s_num;
//s_num = to_string(eleven);
s_total = to_string(total);
if(s_total.length() == 3){
zero="0";
zero += s_total;
s_total = zero;
}
if(s_total.length() == 2){
zero="00";
zero += s_total;
s_total = zero;
}
if(s_total.length() == 1){
zero="000";
zero += s_total;
s_total = zero;
}
return s_total;
}
string LoopAscii(string message, string key){
char ch;
char ch_2;
int a;
int b;
int pathog;
string new_message;
string m;
for(int i=0; i<message.length(); i++){
int p_loop = i;
bool hit = false;
if(p_loop > key.length()){
p_loop = 0;
}
if(p_loop % 5 == 0){
p_loop = p_loop + 4;
if(p_loop > key.length()){ /// 4
p_loop = key.length()-1;
}
hit = true;
}
if(p_loop % 5 == 1 && hit == false){
p_loop = p_loop + 4;
if(p_loop > key.length()){
p_loop = key.length()-2; /// 5
}
hit = true;
}
if(p_loop % 5 == 2 && hit == false){
p_loop = p_loop;
if(p_loop > key.length()){
p_loop = key.length()-3; // 2
}
hit = true;
}
if(p_loop % 5 == 3 && hit == false){ /// 1
p_loop = p_loop - 2;
if(p_loop < key.length()){
p_loop = key.length()-2;
}
hit = true;
}
if(p_loop % 5 == 4 && hit == false){ /// 1
p_loop = p_loop - 1;
if(p_loop > key.length()){
p_loop = key.length()-2;
}
hit = true;
}
ch_2 = key[p_loop];
ch = message[i];
a = (int)ch;
b = (int)ch_2;
pathog = (a + (b/(i+1)) - i);
m = PrimeNumberEqual(pathog);
new_message += m;
// new_message += "-";
}
return new_message;
}
int PrimeGuess(int two, int three, int five, int seven, int eleven){
int guess;
bool found = false;
//bool b_eleven;
for(int i=0; i<37; i++){
bool b_two=false;
bool b_three=false;
bool b_five=false;
bool b_seven=false;
guess = eleven + (11 * i);
if(guess % 7 == seven){
b_seven = true;
}
if(guess % 5 == five && b_seven == true){
b_five = true;
}
if(guess % 3 == three && b_five == true){
b_three = true;
}
if(guess % 2 == two && b_three == true){
return guess;
}
}
return 0;
}
string PrimeNumDec(string message, string key){
string new_message;
string s_num;
int two;
int three;
int five;
int seven;
int eleven;
int remind;
int return_num;
char ch_2;
char ch;
int i_ch;
for(int i=0; i<message.length()-3;){
s_num = message[i];
s_num += message[i+1];
s_num += message[i+2];
s_num += message[i+3];
std::string::size_type sz;
int i_num = std::stoi (s_num,&sz);
remind = i_num % 1155; // 2
two = (i_num - remind)/1155;
i_num = i_num - (two * 1155);
remind = i_num % 385; // 3
three = (i_num - remind)/385;
i_num = i_num - (three * 385);
remind = i_num % 77; // 5
five = (i_num - remind)/77;
i_num = i_num - (five * 77);
remind = i_num % 11; // 7
seven = (i_num - remind)/11;
i_num = i_num - (seven * 11);
eleven = i_num;
return_num = PrimeGuess(two, three, five, seven, eleven);
int p_loop = i/4;
bool hit = false;
if(p_loop > key.length()){
p_loop = 0;
}
if(p_loop % 5 == 0){
p_loop = p_loop + 4;
if(p_loop > key.length()){ /// 4
p_loop = key.length()-1;
}
hit = true;
}
if(p_loop % 5 == 1 && hit == false){
p_loop = p_loop + 4;
if(p_loop > key.length()){
p_loop = key.length()-2; /// 5
}
hit = true;
}
if(p_loop % 5 == 2 && hit == false){
p_loop = p_loop;
if(p_loop > key.length()){
p_loop = key.length()-3; // 2
}
hit = true;
}
if(p_loop % 5 == 3 && hit == false){ /// 1
p_loop = p_loop - 2;
if(p_loop < key.length()){
p_loop = key.length()-2;
}
hit = true;
}
if(p_loop % 5 == 4 && hit == false){ /// 1
p_loop = p_loop - 1;
if(p_loop > key.length()){
p_loop = key.length()-2;
}
hit = true;
}
ch_2 = key[p_loop];
i_ch = (int)ch_2;
// pathog = (a + (b/(i+1)) - i);
return_num = (return_num - (i_ch/((i+4)/4)) + (i/4));
ch = (char)return_num;
new_message += ch;
i = i + 4;
}
return new_message;
}
char DectNum(string val, int key_val, int loop){
int top_val;
if(loop % 2 == 0){
top_val=320+loop+key_val;
}
if(loop % 2 == 1){
top_val=320+loop-key_val;
}
int bottom_val=0;
int guess;
int ch;
string num;
//cout << val << endl;
//guess = ((top_val + bottom_val)/2);
for(int i=0; i<val.length(); i++){
guess = ((top_val + bottom_val)/2);
num = val[i];
if(num == "2"){
top_val = guess;
}
if(num == "1"){
bottom_val = guess;
}
if(num == "0"){
if(loop % 2 == 0){
guess = guess + key_val;
}
if(loop % 2 == 1){
guess = guess - key_val;
}
ch = (char)guess;
return ch;
}
}
ch = (char)guess;
return ch;
}
string Decrypt(string bin, string key){
string password;
string let_bin;
bool first = false;
int loop = 0;
int n;
string num="";
char ch;
for(int i=0; i<bin.length(); i++){
num = bin[i];
if(num == "2" || num == "1"){
let_bin += num;
}
if(num == "0"){
let_bin += num;
n = PasswordNum(key, first, loop);
ch = DectNum(let_bin, n, loop);
password += ch;
let_bin ="";
loop = loop + 1;
first = !first;
}
}
return password;
}
string passwordValue(string password, string bin){
bool round = false;
bool inner_round_1 = false;
bool inner_round_2 = false;
int l_small_1=0;
int l_small_2=0;
string bin_hold;
char ch;
int i_num;
int rem;
int i_n;
string str;
string new_str;
string zero ="0";
string new_bin;
int remid = bin.length() % 3;
for(int loop_big=0; loop_big<bin.length();){
if(round == false){
ch = password[l_small_1];
i_num = (int)ch;
l_small_1 = l_small_1 + 1;
if(l_small_1 == password.length()){
l_small_1 = 0;
}
if(inner_round_1 == false){
rem = i_num % 10;
i_num = i_num - rem;
i_num = (i_num / 10);
i_n = i_num;
}
if(inner_round_1 == true){
rem = i_num % 10;
i_n = rem;
}
inner_round_1 = !inner_round_1;
}
if(round == true){
ch = password[l_small_2];
i_num = (int)ch;
l_small_2 = l_small_2 + 1;
if(l_small_2 == password.length()){
l_small_2 = 0;
}
if(inner_round_2 == true){
rem = i_num % 10;
i_num = i_num - rem;
i_num = (i_num / 10);
i_n = i_num;
}
if(inner_round_2 == false){
rem = i_num % 10;
i_n = rem;
}
inner_round_2 = !inner_round_2;
}
bin_hold = bin[loop_big];
//bin_hold += bin[loop_big+1];
//bin_hold += bin[loop_big+2];
std::string::size_type sz;
int i_st1 = std::stoi (bin_hold,&sz);
while(i_n > 5){
i_n = i_n / M_E;
}
i_st1 = i_st1 * i_n;
str = to_string(i_st1);
/*
if(str.length() == 2){
new_str = zero;
new_str += str;
str = new_str;
}
if(str.length() == 1){
new_str = zero;
new_str += zero;
new_str += str;
str = new_str;
}
*/
new_bin += str;
loop_big = loop_big + 1;
}
return new_bin;
}
string passwordValued(string password, string bin){
bool round = false;
bool inner_round_1 = false;
bool inner_round_2 = false;
int l_small_1=0;
int l_small_2=0;
string bin_hold;
char ch;
int i_num;
int rem;
int i_n;
string str;
string new_str;
string zero ="0";
string new_bin;
int remid = bin.length() % 3;
for(int loop_big=0; loop_big<bin.length()-remid;){
if(round == false){
ch = password[l_small_1];
i_num = (int)ch;
l_small_1 = l_small_1 + 1;
if(l_small_1 == password.length()){
l_small_1 = 0;
}
if(inner_round_1 == false){
rem = i_num % 10;
i_num = i_num - rem;
i_num = (i_num / 10);
i_n = i_num;
}
if(inner_round_1 == true){
rem = i_num % 10;
i_n = rem;
}
inner_round_1 = !inner_round_1;
}
if(round == true){
ch = password[l_small_2];
i_num = (int)ch;
l_small_2 = l_small_2 + 1;
if(l_small_2 == password.length()){
l_small_2 = 0;
}
if(inner_round_2 == true){
rem = i_num % 10;
i_num = i_num - rem;
i_num = (i_num / 10);
i_n = i_num;
}
if(inner_round_2 == false){
rem = i_num % 10;
i_n = rem;
}
inner_round_2 = !inner_round_2;
}
bin_hold = bin[loop_big];
//bin_hold += bin[loop_big+1];
//bin_hold += bin[loop_big+2];
std::string::size_type sz;
int i_st1 = std::stoi (bin_hold,&sz);
while(i_n >= 5){
i_n = i_n / M_E;
}
i_st1 = i_st1 / i_n;
str = to_string(i_st1);
/*
if(str.length() == 2){
/. new_str = zero;
new_str += str;
str = new_str;
}
if(str.length() == 1){
new_str = zero;
new_str += zero;
new_str += str;
str = new_str;
}
*/
new_bin += str;
loop_big = loop_big + 1;
}
return new_bin;
}
string binMCom(string bin){
string x_1;
string y_2;
string z_3;
string w_4;
int total;
string new_bin;
string eq;
while(bin.length() % 4 != 0){
bin += "3";
}
for(int i=0; i<bin.length()-3;){
x_1 = bin[i];
y_2 = bin[i+1];
z_3 = bin[i+2];
w_4 = bin[i+3];
std::string::size_type sz;
int x = std::stoi (x_1 ,&sz);
int y = std::stoi (y_2 ,&sz);
int z = std::stoi (z_3 ,&sz);
int w = std::stoi (w_4 ,&sz);
x = (64 * x);
y = (16 * y);
z = (4 * z);
total = x + y + z + w;
eq = to_string(total);
if(eq.length() < 2){
string new_eq = "00";
new_eq += eq;
eq = new_eq;
}
if(eq.length() < 3){
string new_eq = "0";
new_eq += eq;
eq = new_eq;
}
//cout << eq << endl;
new_bin += eq;
i = i + 4;
}
return new_bin;
}
string BinMDeComp(string bin){
string new_bin;
string a1;
string s_val;
int x;
int y;
int z;
int w;
int total;
int rem;
for(int i=0; i<bin.length();){
a1 = bin[i];
s_val = a1;
a1 = bin[i+1];
s_val += a1;
a1 = bin[i+2];
s_val += a1;
std::string::size_type sz;
int i_val = std::stoi (s_val ,&sz);
// x value / 1st value
total = i_val ;
rem = total % 64;
total = total - rem;
x = total / 64;
//cout << x << " x " << endl;
// y value / 2nd value
total = (i_val - (64 * x));
rem = total % 16;
total = total - rem;
y = total / 16;
//cout << y << " y " << endl;
// z value / 3rd value
total = ((total + rem) - (16 * y));
rem = (total % 4);
total = (total - rem);
z = (total / 4);
//cout << z << " z " << endl;
total = ((total + rem) - (4 * z));
// w value / 4th value
rem = total % 4;
w = rem;
//cout << w << " w " << endl;
if(x != 3){
string x_s = to_string(x);
new_bin += x_s;
}
if(y != 3){
string y_s = to_string(y);
new_bin += y_s;
}
if(z != 3){
string z_s = to_string(z);
new_bin += z_s;
}
if(w != 3){
string w_s = to_string(w);
new_bin += w_s;
}
i = i + 3;
}
return new_bin;
}
string messagepass(string message, string password){
int inner_loop;
int inner_loop_m1;
int inner_loop_p1;
int inner_loop_m2;
int inner_loop_p2;
char ch_1;
char ch_2;
char ch_m1;
char ch_p1;
char ch_m2;
char ch_p2;
string new_message;
for(int i=0; i<message.length(); i++){
bool hit=false;
inner_loop = i;
inner_loop_m1 = i;
inner_loop_m2 = i;
if(i >= 1){
inner_loop_m1 = i - 1;
}
if(i >= 2){
inner_loop_m2 = i - 2;
}
inner_loop_p1 = i + 1;
inner_loop_p2 = i + 2;
while(inner_loop > password.length()){
int p_l = password.length();
inner_loop = inner_loop - p_l;
}
while(inner_loop_m1 > password.length()){
int p_l = password.length();
inner_loop_m1 = inner_loop_m1 - p_l;
}
while(inner_loop_p1 > password.length()){
int p_l = password.length();
inner_loop_p1 = inner_loop_p1 - p_l;
}
while(inner_loop_m2 > password.length()){
int p_l = password.length();
inner_loop_m2 = inner_loop_m2 - p_l;
}
while(inner_loop_p2 > password.length()){
int p_l = password.length();
inner_loop_p2 = inner_loop_p2 - p_l;
}
ch_1 = message[i];
ch_2 = password[inner_loop];
ch_m1 = password[inner_loop_m1];
ch_m2 = password[inner_loop_m2];
ch_p1 = password[inner_loop_p1];
ch_p2 = password[inner_loop_p2];
if(ch_2 == ch_1){
int val=i;
while(val >= 10){
val = val - 10;
}
string i_str = to_string(val);
new_message += i_str;
hit = true;
}
if(ch_1 == ch_m1 && hit == false){
new_message += '-';
hit = true;
}
if(ch_1 == ch_m2 && hit == false){
new_message += '~';
hit = true;
}
if(ch_1 == ch_p1 && hit == false){
new_message += '+';
hit = true;
}
if(ch_1 == ch_p2 && hit == false){
new_message += '#';
hit = true;
}
if(hit == false){
new_message += ch_1;
}
}
return new_message;
}
string messageunpass(string message, string password){
int inner_loop;
int inner_loop_m1;
int inner_loop_p1;
int inner_loop_m2;
int inner_loop_p2;
char ch_1;
char ch_2;
char ch_m1;
char ch_p1;
char ch_m2;
char ch_p2;
for(int i=0; i<message.length(); i++){
inner_loop = i;
inner_loop_m1 = i;
inner_loop_m2 = i;
if(i >= 1){
inner_loop_m1 = i - 1;
}
if(i >= 2){
inner_loop_m2 = i - 2;
}
inner_loop_p1 = i + 1;
inner_loop_p2 = i + 2;
while(inner_loop > password.length()){
int p_l = password.length();
inner_loop = inner_loop - p_l;
}
while(inner_loop_m1 > password.length()){
int p_l = password.length();
inner_loop_m1 = inner_loop_m1 - p_l;
}
while(inner_loop_p1 > password.length()){
int p_l = password.length();
inner_loop_p1 = inner_loop_p1 - p_l;
}
while(inner_loop_m2 > password.length()){
int p_l = password.length();
inner_loop_m2 = inner_loop_m2 - p_l;
}
while(inner_loop_p2 > password.length()){
int p_l = password.length();
inner_loop_p2 = inner_loop_p2 - p_l;
}
ch_1 = message[i];
ch_2 = password[inner_loop];
ch_m1 = password[inner_loop_m1];
ch_m2 = password[inner_loop_m2];
ch_p1 = password[inner_loop_p1];
ch_p2 = password[inner_loop_p2];
ch_1 = message[i];
int val = i;
while(val >= 10){
val = val - 10;
}
string i_s = to_string(val);
ch_2 = password[inner_loop];
string hold ="";
hold += ch_1;
if(hold == i_s){
message[i] = ch_2;
}
if(ch_1 == '-'){
message[i] = ch_m1;
//hit = true;
}
if(ch_1 == '~'){
message[i] = ch_m2;
// hit = true;
}
if(ch_1 == '+'){
message[i] = ch_p1;
//hit = true;
}
if(ch_1 == '#'){
message[i] = ch_p2;
//hit = true;
}
}
return message;
}
string BoxLoop(string message, int dec, string key){
int l = message.length() - key.length();
l = abs(l);
while(l > 100){
l = l /10;
}
//cout << l << " | L " << endl;
for(int i=0; i<l; i++){
if(dec == 1){
message = BoxScramble(message);
}
if(dec == 2){
message = BoxUnScramble(message);
}
}
return message;
}
string swapEncypt1(string message){
string new_message;
char zero;
char one;
char two;
char three;
char four;
char five;
char six;
char seven;
char eigth;
char nine;
char ten;
char eleven;
for(int i=0; i<message.length()-10;){
zero = message[i];
one = message[i+1];
two = message[i+2];
three = message[i+3];
four = message[i+4];
five = message[i+5];
six = message[i+6];
seven = message[i+7];
eigth = message[i+8];
nine = message[i+9];
ten = message[i+10];
eleven = message[i+11];
if(i % 8 == 0 || i % 8 == 2 || i % 8 == 4){
message[i] = eigth;
message[i+1] = seven;
message[i+3] = eleven;
message[i+4] = ten;
message[i+7] = one;
message[i+8] = zero;
message[i+10] = four;
message[i+11] = three;
}
if(i % 8 == 6){
message[i] = six;
message[i+1] = nine;
message[i+2] = ten;
message[i+5] = eleven;
message[i+6] = zero;
//message[i+7] = one;
message[i+9] = one;
message[i+10] = two;
message[i+11] = five;
}
i = i + 2;
}
return message;
}
string swapEncypt2(string message){
string new_message;
char zero;
char one;
char two;
char three;
char four;
char five;
char six;
char seven;
char eigth;
char nine;
char ten;
char eleven;
for(int i=message.length()-12; i>=0;){
zero = message[i];
one = message[i+1];
two = message[i+2];
three = message[i+3];
four = message[i+4];
five = message[i+5];
six = message[i+6];
seven = message[i+7];
eigth = message[i+8];
nine = message[i+9];
ten = message[i+10];
eleven = message[i+11];
if(i % 8 == 6){
message[i] = eigth;
message[i+1] = seven;
message[i+3] = eleven;
message[i+4] = ten;
message[i+7] = one;
message[i+8] = zero;
message[i+10] = four;
message[i+11] = three;
}
if(i % 8 == 0 || i % 8 == 2 || i % 8 == 4){
message[i] = six;
message[i+1] = nine;
message[i+2] = ten;
message[i+5] = eleven;
message[i+6] = zero;
//message[i+7] = one;
message[i+9] = one;
message[i+10] = two;
message[i+11] = five;
}
i = i - 2;
}