-
Notifications
You must be signed in to change notification settings - Fork 0
/
Out.txt
2982 lines (1454 loc) · 56.7 KB
/
Out.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
data string after padding : Hello World!~~~~
plain text with padding is : Hello World!~~~~
01001000011001010110110001101100011011110010000001010111011011110111001001101100011001000010000101111110011111100111111001111110
Printing 64bit block
0100100001100101011011000110110001101111001000000101011101101111
0111001001101100011001000010000101111110011111100111111001111110
Binary string of key :
011011010110010101100111011000010010000001100010011101010110001101101011
out of generate key
.............. Printing ALL KEYS .................
......KEY 0 ........
110000001011111001100110100100101010000100010000
......KEY 1 ........
110000001011111001100110100100101010000100010000
......KEY 2 ........
111100001010011001110110100001010000000000011111
......KEY 3 ........
111100001010011001110110100001010000000000011111
......KEY 4 ........
111100001010011001110110100001010000000000011111
......KEY 5 ........
111100001010011001110110100001010000000000011111
......KEY 6 ........
111100001010011001110110100001010000000000011111
......KEY 7 ........
111100001010011001110110100001010000000000011111
......KEY 8 ........
110000001011111001100110100100101010000100010000
......KEY 9 ........
111100001010011001110110100001010000000000011111
......KEY 10 ........
111100001010011001110110100001010000000000011111
......KEY 11 ........
111100001010011001110110100001010000000000011111
......KEY 12 ........
111100001010011001110110100001010000000000011111
......KEY 13 ........
111100001010011001110110100001010000000000011111
......KEY 14 ........
111100001010011001110110100001010000000000011111
......KEY 15 ........
110000001011111001100110100100101010000100010000
~~~~~~~~~~~~~~~~ ENCRYTION OF BLOCK 0 STARTS ~~~~~~~~~~~~~~~~~~~
transposed data after using PI
1101111101000000110111101101001000000000101111101001110111010000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SIMULATING DES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.................. ITERATION 0..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
000000000001010111111101010011111011111010100000
K_I
110000001011111001100110100100101010000100010000
XOR-ed K_I and expanded 48 bit
110000001010101110011011110111010001111110110000
shortening xor result - Sample 32 bits from the result according to PI_2 array
01001100001110000101011011011111
................ after passing 32 bits through P BOX : 0 ..............
00101110001111101000100001111101
leftmost 32 bit
00000000101111101001110111010000
XOR-ed P box val with leftmost 32 bit
11110001011111100101011010101111
previous leftmost 32 bit of itr 0
00000000101111101001110111010000
previous rightmost 32 bit of itr 0
11110001011111100101011010101111
.................. ITERATION 1..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
111110100010101111111100001010101101010101011111
K_I
110000001011111001100110100100101010000100010000
XOR-ed K_I and expanded 48 bit
001110101001010110011010101110000111010001001111
shortening xor result - Sample 32 bits from the result according to PI_2 array
11100011000010001011111010101000
................ after passing 32 bits through P BOX : 1 ..............
01111001101000001100011011001001
leftmost 32 bit
11110001011111100101011010101111
XOR-ed P box val with leftmost 32 bit
01111001000111100101101100011001
previous leftmost 32 bit of itr 1
11110001011111100101011010101111
previous rightmost 32 bit of itr 1
01111001000111100101101100011001
.................. ITERATION 2..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
101111110010100011111100001011110110100011110010
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
010011111000111010001010101010100110100011101101
shortening xor result - Sample 32 bits from the result according to PI_2 array
10111011000111000011110100101110
................ after passing 32 bits through P BOX : 2 ..............
01111100100010100111011011101010
leftmost 32 bit
01111001000111100101101100011001
XOR-ed P box val with leftmost 32 bit
10001101111101000010000001000101
previous leftmost 32 bit of itr 2
01111001000111100101101100011001
previous rightmost 32 bit of itr 2
10001101111101000010000001000101
.................. ITERATION 3..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
110001011011111110101000000100000000001000001011
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
001101010001100111011110100101010000001000010100
shortening xor result - Sample 32 bits from the result according to PI_2 array
00110000000011101001011011000000
................ after passing 32 bits through P BOX : 3 ..............
00100001011100000001001001001011
leftmost 32 bit
10001101111101000010000001000101
XOR-ed P box val with leftmost 32 bit
01011000011011100100100101010010
previous leftmost 32 bit of itr 3
10001101111101000010000001000101
previous rightmost 32 bit of itr 3
01011000011011100100100101010010
.................. ITERATION 4..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
001011110000001101011100001001010010101010100100
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
110111111010010100101010101000000010101010111011
shortening xor result - Sample 32 bits from the result according to PI_2 array
10011011010011000111111000001111
................ after passing 32 bits through P BOX : 4 ..............
01111000101011110101100011101010
leftmost 32 bit
01011000011011100100100101010010
XOR-ed P box val with leftmost 32 bit
11110101010110110111100010101111
previous leftmost 32 bit of itr 4
01011000011011100100100101010010
previous rightmost 32 bit of itr 4
11110101010110110111100010101111
.................. ITERATION 5..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
111110101010101011110110101111110001010101011111
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
000010100000110010000000001110100001010101000000
shortening xor result - Sample 32 bits from the result according to PI_2 array
01000110000000000010100110000000
................ after passing 32 bits through P BOX : 5 ..............
01010000000000001010000010010001
leftmost 32 bit
11110101010110110111100010101111
XOR-ed P box val with leftmost 32 bit
00001000011011101110100111000011
previous leftmost 32 bit of itr 5
11110101010110110111100010101111
previous rightmost 32 bit of itr 5
00001000011011101110100111000011
.................. ITERATION 6..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
100001010000001101011101011101010011111000000110
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
011101011010010100101011111100000011111000011001
shortening xor result - Sample 32 bits from the result according to PI_2 array
11010011011011000101111010011110
................ after passing 32 bits through P BOX : 6 ..............
01111010101001111101000001101111
leftmost 32 bit
00001000011011101110100111000011
XOR-ed P box val with leftmost 32 bit
10001111111111001010100011000000
previous leftmost 32 bit of itr 6
00001000011011101110100111000011
previous rightmost 32 bit of itr 6
10001111111111001010100011000000
.................. ITERATION 7..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
010001011111111111111001010101010001011000000001
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
101101010101100110001111110100000001011000011110
shortening xor result - Sample 32 bits from the result according to PI_2 array
01110001001011111001011010010001
................ after passing 32 bits through P BOX : 7 ..............
10100011011000001101101001001111
leftmost 32 bit
10001111111111001010100011000000
XOR-ed P box val with leftmost 32 bit
10101011000011100011001110001100
previous leftmost 32 bit of itr 7
10001111111111001010100011000000
previous rightmost 32 bit of itr 7
10101011000011100011001110001100
.................. ITERATION 8..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
010101010110100001011100000110100111110001011001
K_I
110000001011111001100110100100101010000100010000
XOR-ed K_I and expanded 48 bit
100101011101011000111010100010001101110101001001
shortening xor result - Sample 32 bits from the result according to PI_2 array
01010111110111011001010000101101
................ after passing 32 bits through P BOX : 8 ..............
11101101000000011101110101111010
leftmost 32 bit
10101011000011100011001110001100
XOR-ed P box val with leftmost 32 bit
01100010111111010111010110111010
previous leftmost 32 bit of itr 8
10101011000011100011001110001100
previous rightmost 32 bit of itr 8
01100010111111010111010110111010
.................. ITERATION 9..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
001100000101011111111010101110101011110111110100
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
110000001111000110001100001111111011110111101011
shortening xor result - Sample 32 bits from the result according to PI_2 array
11001101100000111100111111001111
................ after passing 32 bits through P BOX : 9 ..............
10011001111111101110100100111001
leftmost 32 bit
01100010111111010111010110111010
XOR-ed P box val with leftmost 32 bit
00110010111100001101101010110101
previous leftmost 32 bit of itr 9
01100010111111010111010110111010
previous rightmost 32 bit of itr 9
00110010111100001101101010110101
.................. ITERATION 10..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
100110100101011110100001011011110101010110101010
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
011010101111000111010111111010100101010110110101
shortening xor result - Sample 32 bits from the result according to PI_2 array
01101100001010111111101100111010
................ after passing 32 bits through P BOX : 10 ..............
10111011011011101010011011010100
leftmost 32 bit
00110010111100001101101010110101
XOR-ed P box val with leftmost 32 bit
11011001100100111101001101101110
previous leftmost 32 bit of itr 10
00110010111100001101101010110101
previous rightmost 32 bit of itr 10
11011001100100111101001101101110
.................. ITERATION 11..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
011011110011110010100111111010100110101101011101
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
100111111001101011010001011011110110101101000010
shortening xor result - Sample 32 bits from the result according to PI_2 array
10010100001101001010100101111101
................ after passing 32 bits through P BOX : 11 ..............
00011111100100000011110010110110
leftmost 32 bit
11011001100100111101001101101110
XOR-ed P box val with leftmost 32 bit
00101101011000001110011000000011
previous leftmost 32 bit of itr 11
11011001100100111101001101101110
previous rightmost 32 bit of itr 11
00101101011000001110011000000011
.................. ITERATION 12..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
100101011010101100000001011100001100000000000110
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
011001010000110101110111111101011100000000011001
shortening xor result - Sample 32 bits from the result according to PI_2 array
00010011111011100001101011110010
................ after passing 32 bits through P BOX : 12 ..............
01110010011100110101010101000111
leftmost 32 bit
00101101011000001110011000000011
XOR-ed P box val with leftmost 32 bit
10101011111000001000011000101001
previous leftmost 32 bit of itr 12
00101101011000001110011000000011
previous rightmost 32 bit of itr 12
10101011111000001000011000101001
.................. ITERATION 13..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
110101010111111100000001010000001100000101010011
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
001001011101100101110111110001011100000101001100
shortening xor result - Sample 32 bits from the result according to PI_2 array
00110101111011111001001001111000
................ after passing 32 bits through P BOX : 13 ..............
10101011011100010101011101010110
leftmost 32 bit
10101011111000001000011000101001
XOR-ed P box val with leftmost 32 bit
10000110000100011011000101010101
previous leftmost 32 bit of itr 13
10101011111000001000011000101001
previous rightmost 32 bit of itr 13
10000110000100011011000101010101
.................. ITERATION 14..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
110000001100000010100011110110100010101010101011
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
001100000110011011010101010111110010101010110100
shortening xor result - Sample 32 bits from the result according to PI_2 array
10101010001100110100000111010100
................ after passing 32 bits through P BOX : 14 ..............
11000110110111000010001000100101
leftmost 32 bit
10000110000100011011000101010101
XOR-ed P box val with leftmost 32 bit
01101101001111001010010000001100
previous leftmost 32 bit of itr 14
10000110000100011011000101010101
previous rightmost 32 bit of itr 14
01101101001111001010010000001100
.................. ITERATION 15..................
Data block
1101111101000000110111101101001000000000101111101001110111010000
expanded 48 bits
001101011010100111111001010100001000000001011000
K_I
110000001011111001100110100100101010000100010000
XOR-ed K_I and expanded 48 bit
111101010001011110011111110000100010000101001000
shortening xor result - Sample 32 bits from the result according to PI_2 array
10010111001111101001011100010011
................ after passing 32 bits through P BOX : 15 ..............
01100111111000100111100001011110
leftmost 32 bit
01101101001111001010010000001100
XOR-ed P box val with leftmost 32 bit
11100001111100111100100100001011
previous leftmost 32 bit of itr 15
01101101001111001010010000001100
previous rightmost 32 bit of itr 15
11100001111100111100100100001011
data block after 16 iterations and swapping
1110000111110011110010010000101101101101001111001010010000001100
after transposing with PI_1
1101010100010001101010101010011100110000111110001101010001011100
in binaryStringTOText
received binary string :
1101010100010001101010101010011100110000111110001101010001011100
Plain_text with/without Padding: Õª§0øÔ\
decrypted plain_text: Õª§0øÔ\
Õª§0øÔ\
~~~~~~~~~~~~~~~~ ENCRYTION OF BLOCK 0 COMPLETE ~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~ DECRYPTION OF BLOCK 0 STARTS ~~~~~~~~~~~~~~~~~~~
transposed data after using PI
1110000111110011110010010000101101101101001111001010010000001100
DE- transposed data using PI
1110000111110011110010010000101101101101001111001010010000001100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SIMULATING DES DECRYPTION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.................. DECRYPTION ITERATION 0..................
Data block
1110000111110011110010010000101101101101001111001010010000001100
expanded 48 bits
001101011010100111111001010100001000000001011000
K_I
110000001011111001100110100100101010000100010000
XOR-ed K_I and expanded 48 bit
111101010001011110011111110000100010000101001000
shortening xor result - Sample 32 bits from the result according to PI_2 array
10010111001111101001011100010011
................ after passing 32 bits through P BOX : 0 ..............
01100111111000100111100001011110
leftmost 32 bit
01101101001111001010010000001100
XOR-ed P box val with leftmost 32 bit
10000110000100011011000101010101
previous leftmost 32 bit of itr 0
01101101001111001010010000001100
previous rightmost 32 bit of itr 0
10000110000100011011000101010101
.................. DECRYPTION ITERATION 1..................
Data block
1110000111110011110010010000101101101101001111001010010000001100
expanded 48 bits
110000001100000010100011110110100010101010101011
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
001100000110011011010101010111110010101010110100
shortening xor result - Sample 32 bits from the result according to PI_2 array
10101010001100110100000111010100
................ after passing 32 bits through P BOX : 1 ..............
11000110110111000010001000100101
leftmost 32 bit
10000110000100011011000101010101
XOR-ed P box val with leftmost 32 bit
10101011111000001000011000101001
previous leftmost 32 bit of itr 1
10000110000100011011000101010101
previous rightmost 32 bit of itr 1
10101011111000001000011000101001
.................. DECRYPTION ITERATION 2..................
Data block
1110000111110011110010010000101101101101001111001010010000001100
expanded 48 bits
110101010111111100000001010000001100000101010011
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
001001011101100101110111110001011100000101001100
shortening xor result - Sample 32 bits from the result according to PI_2 array
00110101111011111001001001111000
................ after passing 32 bits through P BOX : 2 ..............
10101011011100010101011101010110
leftmost 32 bit
10101011111000001000011000101001
XOR-ed P box val with leftmost 32 bit
00101101011000001110011000000011
previous leftmost 32 bit of itr 2
10101011111000001000011000101001
previous rightmost 32 bit of itr 2
00101101011000001110011000000011
.................. DECRYPTION ITERATION 3..................
Data block
1110000111110011110010010000101101101101001111001010010000001100
expanded 48 bits
100101011010101100000001011100001100000000000110
K_I
111100001010011001110110100001010000000000011111
XOR-ed K_I and expanded 48 bit
011001010000110101110111111101011100000000011001
shortening xor result - Sample 32 bits from the result according to PI_2 array
00010011111011100001101011110010
................ after passing 32 bits through P BOX : 3 ..............
01110010011100110101010101000111
leftmost 32 bit
00101101011000001110011000000011
XOR-ed P box val with leftmost 32 bit
11011001100100111101001101101110
previous leftmost 32 bit of itr 3
00101101011000001110011000000011
previous rightmost 32 bit of itr 3
11011001100100111101001101101110
.................. DECRYPTION ITERATION 4..................
Data block
1110000111110011110010010000101101101101001111001010010000001100