Visualizing the Blowfish encryption
Blowfish is a keyed, symetric block cypher with a 64-bit block size and variable key length (32 to 448 bits). It is a 16-round Feistel cipher with large key-dependent S-boxes. In trying to wrap my head around how the Blowfish cipher works, I found it easiest to implement it myself from the ground up, and see how it works. The result of my work is below; a visual path through the Blowfish encryption method.
To illustrate this process, let's imaging an average guy named Joe. He's none too bright, so usually picks a password of "password" to secure anything. Now, Joe has a crush on Sue, so writes a text files with the text "I love Sue." in it. But he's not ready to tell Sue, so he's going to encode that text with the blowfish cypher to keep it safe.
Blowfish works by creating an 'engine' based on a secret key. Then any data can be passed through this engine to encode it, or backwards to decode it. This has several benefits including:
- If you have the 'engine' in memory (i.e. the data tables for the cypher), you don't need to know the key to encode/decode data
- Setting up the 'engine' is rather processor-intensive, while the encode/decode process is fairly easy. So anyone attempting to do a brute-force key attack would have to devote much more processing power to it than for other cyphers
Default structure
The blowfish algorithm needs to seed the values of the P array and the S-blocks, and does so from the fractional values of pi. So first we need the value of pi in hexadecimal. Expressing fractions in hexadecimal is not something usually done, but here's how. Given a decimal fraction, like: 3.1415926535, first convert the integer-portion to hexadecimal (0x3). Then take the fractional portion and multiply by 16: 2.265482456. Take the integral portion and convert it to hexidecimal, adding it to the existing string (0x3.2). Take the fractional portion of the previous result and multiply it by 16 again: 4.247719296 (0x3.24). Repeat the process until you run out of numbers. Note, however that even though we started with only ten digits to the right of the decimal point in decimal, we can continue indefinitely in hex.
So, we need 8×18 = 144 digits for the P array, and 256×8 = 2048 values for each of 4 S-boxes, for a total of 8336 hex digits of pi. In order to accurately calculate that from the decimal version of pi, we need 10,040 digits. Here's 10,040 characters after the decimal point of pi, in decimal (100 characters per line):
00000: 1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 00100: 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 00200: 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 00300: 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 00400: 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 00500: 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 00600: 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 00700: 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 00800: 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 00900: 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532 1712268066 1300192787 6611195909 2164201989 01000: 3809525720 1065485863 2788659361 5338182796 8230301952 0353018529 6899577362 2599413891 2497217752 8347913151 01100: 5574857242 4541506959 5082953311 6861727855 8890750983 8175463746 4939319255 0604009277 0167113900 9848824012 01200: 8583616035 6370766010 4710181942 9555961989 4676783744 9448255379 7747268471 0404753464 6208046684 2590694912 01300: 9331367702 8989152104 7521620569 6602405803 8150193511 2533824300 3558764024 7496473263 9141992726 0426992279 01400: 6782354781 6360093417 2164121992 4586315030 2861829745 5570674983 8505494588 5869269956 9092721079 7509302955 01500: 3211653449 8720275596 0236480665 4991198818 3479775356 6369807426 5425278625 5181841757 4672890977 7727938000 01600: 8164706001 6145249192 1732172147 7235014144 1973568548 1613611573 5255213347 5741849468 4385233239 0739414333 01700: 4547762416 8625189835 6948556209 9219222184 2725502542 5688767179 0494601653 4668049886 2723279178 6085784383 01800: 8279679766 8145410095 3883786360 9506800642 2512520511 7392984896 0841284886 2694560424 1965285022 2106611863 01900: 0674427862 2039194945 0471237137 8696095636 4371917287 4677646575 7396241389 0865832645 9958133904 7802759009 02000: 9465764078 9512694683 9835259570 9825822620 5224894077 2671947826 8482601476 9909026401 3639443745 5305068203 02100: 4962524517 4939965143 1429809190 6592509372 2169646151 5709858387 4105978859 5977297549 8930161753 9284681382 02200: 6868386894 2774155991 8559252459 5395943104 9972524680 8459872736 4469584865 3836736222 6260991246 0805124388 02300: 4390451244 1365497627 8079771569 1435997700 1296160894 4169486855 5848406353 4220722258 2848864815 8456028506 02400: 0168427394 5226746767 8895252138 5225499546 6672782398 6456596116 3548862305 7745649803 5593634568 1743241125 02500: 1507606947 9451096596 0940252288 7971089314 5669136867 2287489405 6010150330 8617928680 9208747609 1782493858 02600: 9009714909 6759852613 6554978189 3129784821 6829989487 2265880485 7564014270 4775551323 7964145152 3746234364 02700: 5428584447 9526586782 1051141354 7357395231 1342716610 2135969536 2314429524 8493718711 0145765403 5902799344 02800: 0374200731 0578539062 1983874478 0847848968 3321445713 8687519435 0643021845 3191048481 0053706146 8067491927 02900: 8191197939 9520614196 6342875444 0643745123 7181921799 9839101591 9561814675 1426912397 4894090718 6494231961 03000: 5679452080 9514655022 5231603881 9301420937 6213785595 6638937787 0830390697 9207734672 2182562599 6615014215 03100: 0306803844 7734549202 6054146659 2520149744 2850732518 6660021324 3408819071 0486331734 6496514539 0579626856 03200: 1005508106 6587969981 6357473638 4052571459 1028970641 4011097120 6280439039 7595156771 5770042033 7869936007 03300: 2305587631 7635942187 3125147120 5329281918 2618612586 7321579198 4148488291 6447060957 5270695722 0917567116 03400: 7229109816 9091528017 3506712748 5832228718 3520935396 5725121083 5791513698 8209144421 0067510334 6711031412 03500: 6711136990 8658516398 3150197016 5151168517 1437657618 3515565088 4909989859 9823873455 2833163550 7647918535 03600: 8932261854 8963213293 3089857064 2046752590 7091548141 6549859461 6371802709 8199430992 4488957571 2828905923 03700: 2332609729 9712084433 5732654893 8239119325 9746366730 5836041428 1388303203 8249037589 8524374417 0291327656 03800: 1809377344 4030707469 2112019130 2033038019 7621101100 4492932151 6084244485 9637669838 9522868478 3123552658 03900: 2131449576 8572624334 4189303968 6426243410 7732269780 2807318915 4411010446 8232527162 0105265227 2111660396 04000: 6655730925 4711055785 3763466820 6531098965 2691862056 4769312570 5863566201 8558100729 3606598764 8611791045 04100: 3348850346 1136576867 5324944166 8039626579 7877185560 8455296541 2665408530 6143444318 5867697514 5661406800 04200: 7002378776 5913440171 2749470420 5622305389 9456131407 1127000407 8547332699 3908145466 4645880797 2708266830 04300: 6343285878 5698305235 8089330657 5740679545 7163775254 2021149557 6158140025 0126228594 1302164715 5097925923 04400: 0990796547 3761255176 5675135751 7829666454 7791745011 2996148903 0463994713 2962107340 4375189573 5961458901 04500: 9389713111 7904297828 5647503203 1986915140 2870808599 0480109412 1472213179 4764777262 2414254854 5403321571 04600: 8530614228 8137585043 0633217518 2979866223 7172159160 7716692547 4873898665 4949450114 6540628433 6639379003 04700: 9769265672 1463853067 3609657120 9180763832 7166416274 8888007869 2560290228 4721040317 2118608204 1900042296 04800: 6171196377 9213375751 1495950156 6049631862 9472654736 4252308177 0367515906 7350235072 8354056704 0386743513 04900: 6222247715 8915049530 9844489333 0963408780 7693259939 7805419341 4473774418 4263129860 8099888687 4132604721 05000: 5695162396 5864573021 6315981931 9516735381 2974167729 4786724229 2465436680 0980676928 2382806899 6400482435 05100: 4037014163 1496589794 0924323789 6907069779 4223625082 2168895738 3798623001 5937764716 5122893578 6015881617 05200: 5578297352 3344604281 5126272037 3431465319 7777416031 9906655418 7639792933 4419521541 3418994854 4473456738 05300: 3162499341 9131814809 2777710386 3877343177 2075456545 3220777092 1201905166 0962804909 2636019759 8828161332 05400: 3166636528 6193266863 3606273567 6303544776 2803504507 7723554710 5859548702 7908143562 4014517180 6246436267 05500: 9456127531 8134078330 3362542327 8394497538 2437205835 3114771199 2606381334 6776879695 9703098339 1307710987 05600: 0408591337 4641442822 7726346594 7047458784 7787201927 7152807317 6790770715 7213444730 6057007334 9243693113 05700: 8350493163 1284042512 1925651798 0694113528 0131470130 4781643788 5185290928 5452011658 3934196562 1349143415 05800: 9562586586 5570552690 4965209858 0338507224 2648293972 8584783163 0577775606 8887644624 8246857926 0395352773 05900: 4803048029 0058760758 2510474709 1643961362 6760449256 2742042083 2085661190 6254543372 1315359584 5068772460 06000: 2901618766 7952406163 4252257719 5429162991 9306455377 9914037340 4328752628 8896399587 9475729174 6426357455 06100: 2540790914 5135711136 9410911939 3251910760 2082520261 8798531887 7058429725 9167781314 9699009019 2116971737 06200: 2784768472 6860849003 3770242429 1651300500 5168323364 3503895170 2989392233 4517220138 1280696501 1784408745 06300: 1960121228 5993716231 3017114448 4640903890 6449544400 6198690754 8516026327 5052983491 8740786680 8818338510 06400: 2283345085 0486082503 9302133219 7155184306 3545500766 8282949304 1377655279 3975175461 3953984683 3936383047 06500: 4611996653 8581538420 5685338621 8672523340 2830871123 2827892125 0771262946 3229563989 8989358211 6745627010 06600: 2183564622 0134967151 8819097303 8119800497 3407239610 3685406643 1939509790 1906996395 5245300545 0580685501 06700: 9567302292 1913933918 5680344903 9820595510 0226353536 1920419947 4553859381 0234395544 9597783779 0237421617 06800: 2711172364 3435439478 2218185286 2408514006 6604433258 8856986705 4315470696 5747458550 3323233421 0730154594 06900: 0516553790 6866273337 9958511562 5784322988 2737231989 8757141595 7811196358 3300594087 3068121602 8764962867 07000: 4460477464 9159950549 7374256269 0104903778 1986835938 1465741268 0492564879 8556145372 3478673303 9046883834 07100: 3634655379 4986419270 5638729317 4872332083 7601123029 9113679386 2708943879 9362016295 1541337142 4892830722 07200: 0126901475 4668476535 7616477379 4675200490 7571555278 1965362132 3926406160 1363581559 0742202020 3187277605 07300: 2772190055 6148425551 8792530343 5139844253 2234157623 3610642506 3904975008 6562710953 5919465897 5141310348 07400: 2276930624 7435363256 9160781547 8181152843 6679570611 0861533150 4452127473 9245449454 2368288606 1340841486 07500: 3776700961 2071512491 4043027253 8607648236 3414334623 5189757664 5216413767 9690314950 1910857598 4423919862 07600: 9164219399 4907236234 6468441173 9403265918 4044378051 3338945257 4239950829 6591228508 5558215725 0310712570 07700: 1266830240 2929525220 1187267675 6220415420 5161841634 8475651699 9811614101 0029960783 8690929160 3028840026 07800: 9104140792 8862150784 2451670908 7000699282 1206604183 7180653556 7252532567 5328612910 4248776182 5829765157 07900: 9598470356 2226293486 0034158722 9805349896 5022629174 8788202734 2092222453 3985626476 6914905562 8425039127 08000: 5771028402 7998066365 8254889264 8802545661 0172967026 6407655904 2909945681 5065265305 3718294127 0336931378 08100: 5178609040 7086671149 6558343434 7693385781 7113864558 7367812301 4587687126 6034891390 9562009939 3610310291 08200: 6161528813 8437909904 2317473363 9480457593 1493140529 7634757481 1935670911 0137751721 0080315590 2485309066 08300: 9203767192 2033229094 3346768514 2214477379 3937517034 4366199104 0337511173 5471918550 4644902636 5512816228 08400: 8244625759 1633303910 7225383742 1821408835 0865739177 1509682887 4782656995 9957449066 1758344137 5223970968 08500: 3408005355 9849175417 3818839994 4697486762 6551658276 5848358845 3142775687 9002909517 0283529716 3445621296 08600: 4043523117 6006651012 4120065975 5851276178 5838292041 9748442360 8007193045 7618932349 2292796501 9875187212 08700: 7267507981 2554709589 0455635792 1221033346 6974992356 3025494780 2490114195 2123828153 0911407907 3860251522 08800: 7429958180 7247162591 6685451333 1239480494 7079119153 2673430282 4418604142 6363954800 0448002670 4962482017 08900: 9289647669 7583183271 3142517029 6923488962 7668440323 2609275249 6035799646 9256504936 8183609003 2380929345 09000: 9588970695 3653494060 3402166544 3755890045 6328822505 4525564056 4482465151 8754711962 1844396582 5337543885 09100: 6909411303 1509526179 3780029741 2076651479 3942590298 9695946995 5657612186 5619673378 6236256125 2163208628 09200: 6922210327 4889218654 3648022967 8070576561 5144632046 9279068212 0738837781 4233562823 6089632080 6822246801 09300: 2248261177 1858963814 0918390367 3672220888 3215137556 0037279839 4004152970 0287830766 7094447456 0134556417 09400: 2543709069 7939612257 1429894671 5435784687 8861444581 2314593571 9849225284 7160504922 1242470141 2147805734 09500: 5510500801 9086996033 0276347870 8108175450 1193071412 2339086639 3833952942 5786905076 4310063835 1983438934 09600: 1596131854 3475464955 6978103829 3097164651 4384070070 7360411237 3599843452 2516105070 2705623526 6012764848 09700: 3084076118 3013052793 2054274628 6540360367 4532865105 7065874882 2569815793 6789766974 2205750596 8344086973 09800: 5020141020 6723585020 0724522563 2651341055 9240190274 2162484391 4035998953 5394590944 0704691209 1409387001 09900: 2645600162 3742880210 9276457931 0657922955 2498872758 4610126483 6999892256 9596881592 0560010165 5256375678 10000: 5667227966 1988578279 4848855834 3975187445
Convert that to hex (using a precision of 10,040 digits, when multiplying by 16), and here's the first 8336 characters of the result (in 8-digit chunks, 16 chunks (128 digits) per row):
0x0000: 243f6a88 85a308d3 13198a2e 03707344 a4093822 299f31d0 082efa98 ec4e6c89 452821e6 38d01377 be5466cf 34e90c6c c0ac29b7 c97c50dd 3f84d5b5 b5470917 0x0080: 9216d5d9 8979fb1b d1310ba6 98dfb5ac 2ffd72db d01adfb7 b8e1afed 6a267e96 ba7c9045 f12c7f99 24a19947 b3916cf7 0801f2e2 858efc16 636920d8 71574e69 0x0100: a458fea3 f4933d7e 0d95748f 728eb658 718bcd58 82154aee 7b54a41d c25a59b5 9c30d539 2af26013 c5d1b023 286085f0 ca417918 b8db38ef 8e79dcb0 603a180e 0x0180: 6c9e0e8b b01e8a3e d71577c1 bd314b27 78af2fda 55605c60 e65525f3 aa55ab94 57489862 63e81440 55ca396a 2aab10b6 b4cc5c34 1141e8ce a15486af 7c72e993 0x0200: b3ee1411 636fbc2a 2ba9c55d 741831f6 ce5c3e16 9b87931e afd6ba33 6c24cf5c 7a325381 28958677 3b8f4898 6b4bb9af c4bfe81b 66282193 61d809cc fb21a991 0x0280: 487cac60 5dec8032 ef845d5d e98575b1 dc262302 eb651b88 23893e81 d396acc5 0f6d6ff3 83f44239 2e0b4482 a4842004 69c8f04a 9e1f9b5e 21c66842 f6e96c9a 0x0300: 670c9c61 abd388f0 6a51a0d2 d8542f68 960fa728 ab5133a3 6eef0b6c 137a3be4 ba3bf050 7efb2a98 a1f1651d 39af0176 66ca593e 82430e88 8cee8619 456f9fb4 0x0380: 7d84a5c3 3b8b5ebe e06f75d8 85c12073 401a449f 56c16aa6 4ed3aa62 363f7706 1bfedf72 429b023d 37d0d724 d00a1248 db0fead3 49f1c09b 075372c9 80991b7b 0x0400: 25d479d8 f6e8def7 e3fe501a b6794c3b 976ce0bd 04c006ba c1a94fb6 409f60c4 5e5c9ec2 196a2463 68fb6faf 3e6c53b5 1339b2eb 3b52ec6f 6dfc511f 9b30952c 0x0480: cc814544 af5ebd09 bee3d004 de334afd 660f2807 192e4bb3 c0cba857 45c8740f d20b5f39 b9d3fbdb 5579c0bd 1a60320a d6a100c6 402c7279 679f25fe fb1fa3cc 0x0500: 8ea5e9f8 db3222f8 3c7516df fd616b15 2f501ec8 ad0552ab 323db5fa fd238760 53317b48 3e00df82 9e5c57bb ca6f8ca0 1a87562e df1769db d542a8f6 287effc3 0x0580: ac6732c6 8c4f5573 695b27b0 bbca58c8 e1ffa35d b8f011a0 10fa3d98 fd2183b8 4afcb56c 2dd1d35b 9a53e479 b6f84565 d28e49bc 4bfb9790 e1ddf2da a4cb7e33 0x0600: 62fb1341 cee4c6e8 ef20cada 36774c01 d07e9efe 2bf11fb4 95dbda4d ae909198 eaad8e71 6b93d5a0 d08ed1d0 afc725e0 8e3c5b2f 8e7594b7 8ff6e2fb f2122b64 0x0680: 8888b812 900df01c 4fad5ea0 688fc31c d1cff191 b3a8c1ad 2f2f2218 be0e1777 ea752dfe 8b021fa1 e5a0cc0f b56f74e8 18acf3d6 ce89e299 b4a84fe0 fd13e0b7 0x0700: 7cc43b81 d2ada8d9 165fa266 80957705 93cc7314 211a1477 e6ad2065 77b5fa86 c75442f5 fb9d35cf ebcdaf0c 7b3e89a0 d6411bd3 ae1e7e49 00250e2d 2071b35e 0x0780: 226800bb 57b8e0af 2464369b f009b91e 5563911d 59dfa6aa 78c14389 d95a537f 207d5ba2 02e5b9c5 83260376 6295cfa9 11c81968 4e734a41 b3472dca 7b14a94a 0x0800: 1b510052 9a532915 d60f573f bc9bc6e4 2b60a476 81e67400 08ba6fb5 571be91f f296ec6b 2a0dd915 b6636521 e7b9f9b6 ff34052e c5855664 53b02d5d a99f8fa1 0x0880: 08ba4799 6e85076a 4b7a70e9 b5b32944 db75092e c4192623 ad6ea6b0 49a7df7d 9cee60b8 8fedb266 ecaa8c71 699a17ff 5664526c c2b19ee1 193602a5 75094c29 0x0900: a0591340 e4183a3e 3f54989a 5b429d65 6b8fe4d6 99f73fd6 a1d29c07 efe830f5 4d2d38e6 f0255dc1 4cdd2086 8470eb26 6382e9c6 021ecc5e 09686b3f 3ebaefc9 0x0980: 3c971814 6b6a70a1 687f3584 52a0e286 b79c5305 aa500737 3e07841c 7fdeae5c 8e7d44ec 5716f2b8 b03ada37 f0500c0d f01c1f04 0200b3ff ae0cf51a 3cb574b2 0x0a00: 25837a58 dc0921bd d19113f9 7ca92ff6 94324773 22f54701 3ae5e581 37c2dadc c8b57634 9af3dda7 a9446146 0fd0030e ecc8c73e a4751e41 e238cd99 3bea0e2f 0x0a80: 3280bba1 183eb331 4e548b38 4f6db908 6f420d03 f60a04bf 2cb81290 24977c79 5679b072 bcaf89af de9a771f d9930810 b38bae12 dccf3f2e 5512721f 2e6b7124 0x0b00: 501adde6 9f84cd87 7a584718 7408da17 bc9f9abc e94b7d8c ec7aec3a db851dfa 63094366 c464c3d2 ef1c1847 3215d908 dd433b37 24c2ba16 12a14d43 2a65c451 0x0b80: 50940002 133ae4dd 71dff89e 10314e55 81ac77d6 5f11199b 043556f1 d7a3c76b 3c11183b 5924a509 f28fe6ed 97f1fbfa 9ebabf2c 1e153c6e 86e34570 eae96fb1 0x0c00: 860e5e0a 5a3e2ab3 771fe71c 4e3d06fa 2965dcb9 99e71d0f 803e89d6 5266c825 2e4cc978 9c10b36a c6150eba 94e2ea78 a5fc3c53 1e0a2df4 f2f74ea7 361d2b3d 0x0c80: 1939260f 19c27960 5223a708 f71312b6 ebadfe6e eac31f66 e3bc4595 a67bc883 b17f37d1 018cff28 c332ddef be6c5aa5 65582185 68ab9802 eecea50f db2f953b 0x0d00: 2aef7dad 5b6e2f84 1521b628 29076170 ecdd4775 619f1510 13cca830 eb61bd96 0334fe1e aa0363cf b5735c90 4c70a239 d59e9e0b cbaade14 eecc86bc 60622ca7 0x0d80: 9cab5cab b2f3846e 648b1eaf 19bdf0ca a02369b9 655abb50 40685a32 3c2ab4b3 319ee9d5 c021b8f7 9b540b19 875fa099 95f7997e 623d7da8 f837889a 97e32d77 0x0e00: 11ed935f 16681281 0e358829 c7e61fd6 96dedfa1 7858ba99 57f584a5 1b227263 9b83c3ff 1ac24696 cdb30aeb 532e3054 8fd948e4 6dbc3128 58ebf2ef 34c6ffea 0x0e80: fe28ed61 ee7c3c73 5d4a14d9 e864b7e3 42105d14 203e13e0 45eee2b6 a3aaabea db6c4f15 facb4fd0 c742f442 ef6abbb5 654f3b1d 41cd2105 d81e799e 86854dc7 0x0f00: e44b476a 3d816250 cf62a1f2 5b8d2646 fc8883a0 c1c7b6a3 7f1524c3 69cb7492 47848a0b 5692b285 095bbf00 ad19489d 1462b174 23820e00 58428d2a 0c55f5ea 0x0f80: 1dadf43e 233f7061 3372f092 8d937e41 d65fecf1 6c223bdb 7cde3759 cbee7460 4085f2a7 ce77326e a6078084 19f8509e e8efd855 61d99735 a969a7aa c50c06c2 0x1000: 5a04abfc 800bcadc 9e447a2e c3453484 fdd56705 0e1e9ec9 db73dbd3 105588cd 675fda79 e3674340 c5c43465 713e38d8 3d28f89e f16dff20 153e21e7 8fb03d4a 0x1080: e6e39f2b db83adf7 e93d5a68 948140f7 f64c261c 94692934 411520f7 7602d4f7 bcf46b2e d4a20068 d4082471 3320f46a 43b7d4b7 500061af 1e39f62e 97244546 0x1100: 14214f74 bf8b8840 4d95fc1d 96b591af 70f4ddd3 66a02f45 bfbc09ec 03bd9785 7fac6dd0 31cb8504 96eb27b3 55fd3941 da2547e6 abca0a9a 28507825 530429f4 0x1180: 0a2c86da e9b66dfb 68dc1462 d7486900 680ec0a4 27a18dee 4f3ffea2 e887ad8c b58ce006 7af4d6b6 aace1e7c d3375fec ce78a399 406b2a42 20fe9e35 d9f385b9 0x1200: ee39d7ab 3b124e8b 1dc9faf7 4b6d1856 26a36631 eae397b2 3a6efa74 dd5b4332 6841e7f7 ca7820fb fb0af54e d8feb397 454056ac ba489527 55533a3a 20838d87 0x1280: fe6ba9b7 d096954b 55a867bc a1159a58 cca92963 99e1db33 a62a4a56 3f3125f9 5ef47e1c 9029317c fdf8e802 04272f70 80bb155c 05282ce3 95c11548 e4c66d22 0x1300: 48c1133f c70f86dc 07f9c9ee 41041f0f 404779a4 5d886e17 325f51eb d59bc0d1 f2bcc18f 41113564 257b7834 602a9c60 dff8e8a3 1f636c1b 0e12b4c2 02e1329e 0x1380: af664fd1 cad18115 6b2395e0 333e92e1 3b240b62 eebeb922 85b2a20e e6ba0d99 de720c8c 2da2f728 d0127845 95b794fd 647d0862 e7ccf5f0 5449a36f 877d48fa 0x1400: c39dfd27 f33e8d1e 0a476341 992eff74 3a6f6eab f4f8fd37 a812dc60 a1ebddf8 991be14c db6e6b0d c67b5510 6d672c37 2765d43b dcd0e804 f1290dc7 cc00ffa3 0x1480: b5390f92 690fed0b 667b9ffb cedb7d9c a091cf0b d9155ea3 bb132f88 515bad24 7b9479bf 763bd6eb 37392eb3 cc115979 8026e297 f42e312d 6842ada7 c66a2b3b 0x1500: 12754ccc 782ef11c 6a124237 b79251e7 06a1bbe6 4bfb6350 1a6b1018 11caedfa 3d25bdd8 e2e1c3c9 44421659 0a121386 d90cec6e d5abea2a 64af674e da86a85f 0x1580: bebfe988 64e4c3fe 9dbc8057 f0f7c086 60787bf8 6003604d d1fd8346 f6381fb0 7745ae04 d736fccc 83426b33 f01eab71 b0804187 3c005e5f 77a057be bde8ae24 0x1600: 55464299 bf582e61 4e58f48f f2ddfda2 f474ef38 8789bdc2 5366f9c3 c8b38e74 b475f255 46fcd9b9 7aeb2661 8b1ddf84 846a0e79 915f95e2 466e598e 20b45770 0x1680: 8cd55591 c902de4c b90bace1 bb8205d0 11a86248 7574a99e b77f19b6 e0a9dc09 662d09a1 c4324633 e85a1f02 09f0be8c 4a99a025 1d6efe10 1ab93d1d 0ba5a4df 0x1700: a186f20f 2868f169 dcb7da83 573906fe a1e2ce9b 4fcd7f52 50115e01 a70683fa a002b5c4 0de6d027 9af88c27 773f8641 c3604c06 61a806b5 f0177a28 c0f586e0 0x1780: 006058aa 30dc7d62 11e69ed7 2338ea63 53c2dd94 c2c21634 bbcbee56 90bcb6de ebfc7da1 ce591d76 6f05e409 4b7c0188 39720a3d 7c927c24 86e3725f 724d9db9 0x1800: 1ac15bb4 d39eb8fc ed545578 08fca5b5 d83d7cd3 4dad0fc4 1e50ef5e b161e6f8 a28514d9 6c51133c 6fd5c7e7 56e14ec4 362abfce ddc6c837 d79a3234 92638212 0x1880: 670efa8e 406000e0 3a39ce37 d3faf5cf abc27737 5ac52d1b 5cb0679e 4fa33742 d3822740 99bc9bbe d5118e9d bf0f7315 d62d1c7e c700c47b b78c1b6b 21a19045 0x1900: b26eb1be 6a366eb4 5748ab2f bc946e79 c6a376d2 6549c2c8 530ff8ee 468dde7d d5730a1d 4cd04dc6 2939bbdb a9ba4650 ac9526e8 be5ee304 a1fad5f0 6a2d519a 0x1980: 63ef8ce2 9a86ee22 c089c2b8 43242ef6 a51e03aa 9cf2d0a4 83c061ba 9be96a4d 8fe51550 ba645bd6 2826a2f9 a73a3ae1 4ba99586 ef5562e9 c72fefd3 f752f7da 0x1a00: 3f046f69 77fa0a59 80e4a915 87b08601 9b09e6ad 3b3ee593 e990fd5a 9e34d797 2cf0b7d9 022b8b51 96d5ac3a 017da67d d1cf3ed6 7c7d2d28 1f9f25cf adf2b89b 0x1a80: 5ad6b472 5a88f54c e029ac71 e019a5e6 47b0acfd ed93fa9b e8d3c48d 283b57cc f8d56629 79132e28 785f0191 ed756055 f7960e44 e3d35e8c 15056dd4 88f46dba 0x1b00: 03a16125 0564f0bd c3eb9e15 3c9057a2 97271aec a93a072a 1b3f6d9b 1e6321f5 f59c66fb 26dcf319 7533d928 b155fdf5 03563482 8aba3cbb 28517711 c20ad9f8 0x1b80: abcc5167 ccad925f 4de81751 3830dc8e 379d5862 9320f991 ea7a90c2 fb3e7bce 5121ce64 774fbe32 a8b6e37e c3293d46 48de5369 6413e680 a2ae0810 dd6db224 0x1c00: 69852dfd 09072166 b39a460a 6445c0dd 586cdecf 1c20c8ae 5bbef7dd 1b588d40 ccd2017f 6bb4e3bb dda26a7e 3a59ff45 3e350a44 bcb4cdd5 72eacea8 fa6484bb 0x1c80: 8d6612ae bf3c6f47 d29be463 542f5d9e aec2771b f64e6370 740e0d8d e75b1357 f8721671 af537d5d 4040cb08 4eb4e2cc 34d2466a 0115af84 e1b00428 95983a1d 0x1d00: 06b89fb4 ce6ea048 6f3f3b82 3520ab82 011a1d4b 277227f8 611560b1 e7933fdc bb3a792b 344525bd a08839e1 51ce794b 2f32c9b7 a01fbac9 e01cc87e bcc7d1f6 0x1d80: cf0111c3 a1e8aac7 1a908749 d44fbd9a d0dadecb d50ada38 0339c32a c6913667 8df9317c e0b12b4f f79e59b7 43f5bb3a f2d519ff 27d9459c bf97222c 15e6fc2a 0x1e00: 0f91fc71 9b941525 fae59361 ceb69ceb c2a86459 12baa8d1 b6c1075e e3056a0c 10d25065 cb03a442 e0ec6e0e 1698db3b 4c98a0be 3278e964 9f1f9532 e0d392df 0x1e80: d3a0342b 8971f21e 1b0a7441 4ba3348c c5be7120 c37632d8 df359f8d 9b992f2e e60b6f47 0fe3f11d e54cda54 1edad891 ce6279cf cd3e7e6f 1618b166 fd2c1d05 0x1f00: 848fd2c5 f6fb2299 f523f357 a6327623 93a83531 56cccd02 acf08162 5a75ebb5 6e163697 88d273cc de966292 81b949d0 4c50901b 71c65614 e6c6c7bd 327a140a 0x1f80: 45e1d006 c3f27b9a c9aa53fd 62a80f00 bb25bfe2 35bdd2f6 71126905 b2040222 b6cbcf7c cd769c2b 53113ec0 1640e3d3 38abbd60 2547adf0 ba38209c f746ce76 0x2000: 77afa1c5 20756060 85cbfe4e 8ae88dd8 7aaaf9b0 4cf9aa7e 1948c25c 02fb8a8c 01c36ae4 d6ebe1f9 90d4f869 a65cdea0 3f09252d c208e69f b74e6132 ce77e25b 0x2080: 578fdfe3 3ac372e6
That's all the bits we need to seed the generator to begin. The default values get laid out into the P Array, and S-Boxes like so:
P Array | ||
---|---|---|
ID | Hex | Binary |
P1 | 243f6a88 | 00100100001111110110101010001000 |
P2 | 85a308d3 | 10000101101000110000100011010011 |
P3 | 13198a2e | 00010011000110011000101000101110 |
P4 | 03707344 | 00000011011100000111001101000100 |
P5 | a4093822 | 10100100000010010011100000100010 |
P6 | 299f31d0 | 00101001100111110011000111010000 |
P7 | 082efa98 | 00001000001011101111101010011000 |
P8 | ec4e6c89 | 11101100010011100110110010001001 |
P9 | 452821e6 | 01000101001010000010000111100110 |
P10 | 38d01377 | 00111000110100000001001101110111 |
P11 | be5466cf | 10111110010101000110011011001111 |
P12 | 34e90c6c | 00110100111010010000110001101100 |
P13 | c0ac29b7 | 11000000101011000010100110110111 |
P14 | c97c50dd | 11001001011111000101000011011101 |
P15 | 3f84d5b5 | 00111111100001001101010110110101 |
P16 | b5470917 | 10110101010001110000100100010111 |
P17 | 9216d5d9 | 10010010000101101101010111011001 |
P18 | 8979fb1b | 10001001011110011111101100011011 |
S-Box 1 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | d1310ba6 | 98dfb5ac | 2ffd72db | d01adfb7 | b8e1afed | 6a267e96 | ba7c9045 | f12c7f99 | 24a19947 | b3916cf7 | 0801f2e2 | 858efc16 | 636920d8 | 71574e69 | a458fea3 | f4933d7e |
10 | 0d95748f | 728eb658 | 718bcd58 | 82154aee | 7b54a41d | c25a59b5 | 9c30d539 | 2af26013 | c5d1b023 | 286085f0 | ca417918 | b8db38ef | 8e79dcb0 | 603a180e | 6c9e0e8b | b01e8a3e |
20 | d71577c1 | bd314b27 | 78af2fda | 55605c60 | e65525f3 | aa55ab94 | 57489862 | 63e81440 | 55ca396a | 2aab10b6 | b4cc5c34 | 1141e8ce | a15486af | 7c72e993 | b3ee1411 | 636fbc2a |
30 | 2ba9c55d | 741831f6 | ce5c3e16 | 9b87931e | afd6ba33 | 6c24cf5c | 7a325381 | 28958677 | 3b8f4898 | 6b4bb9af | c4bfe81b | 66282193 | 61d809cc | fb21a991 | 487cac60 | 5dec8032 |
40 | ef845d5d | e98575b1 | dc262302 | eb651b88 | 23893e81 | d396acc5 | 0f6d6ff3 | 83f44239 | 2e0b4482 | a4842004 | 69c8f04a | 9e1f9b5e | 21c66842 | f6e96c9a | 670c9c61 | abd388f0 |
50 | 6a51a0d2 | d8542f68 | 960fa728 | ab5133a3 | 6eef0b6c | 137a3be4 | ba3bf050 | 7efb2a98 | a1f1651d | 39af0176 | 66ca593e | 82430e88 | 8cee8619 | 456f9fb4 | 7d84a5c3 | 3b8b5ebe |
60 | e06f75d8 | 85c12073 | 401a449f | 56c16aa6 | 4ed3aa62 | 363f7706 | 1bfedf72 | 429b023d | 37d0d724 | d00a1248 | db0fead3 | 49f1c09b | 075372c9 | 80991b7b | 25d479d8 | f6e8def7 |
70 | e3fe501a | b6794c3b | 976ce0bd | 04c006ba | c1a94fb6 | 409f60c4 | 5e5c9ec2 | 196a2463 | 68fb6faf | 3e6c53b5 | 1339b2eb | 3b52ec6f | 6dfc511f | 9b30952c | cc814544 | af5ebd09 |
80 | bee3d004 | de334afd | 660f2807 | 192e4bb3 | c0cba857 | 45c8740f | d20b5f39 | b9d3fbdb | 5579c0bd | 1a60320a | d6a100c6 | 402c7279 | 679f25fe | fb1fa3cc | 8ea5e9f8 | db3222f8 |
90 | 3c7516df | fd616b15 | 2f501ec8 | ad0552ab | 323db5fa | fd238760 | 53317b48 | 3e00df82 | 9e5c57bb | ca6f8ca0 | 1a87562e | df1769db | d542a8f6 | 287effc3 | ac6732c6 | 8c4f5573 |
a0 | 695b27b0 | bbca58c8 | e1ffa35d | b8f011a0 | 10fa3d98 | fd2183b8 | 4afcb56c | 2dd1d35b | 9a53e479 | b6f84565 | d28e49bc | 4bfb9790 | e1ddf2da | a4cb7e33 | 62fb1341 | cee4c6e8 |
b0 | ef20cada | 36774c01 | d07e9efe | 2bf11fb4 | 95dbda4d | ae909198 | eaad8e71 | 6b93d5a0 | d08ed1d0 | afc725e0 | 8e3c5b2f | 8e7594b7 | 8ff6e2fb | f2122b64 | 8888b812 | 900df01c |
c0 | 4fad5ea0 | 688fc31c | d1cff191 | b3a8c1ad | 2f2f2218 | be0e1777 | ea752dfe | 8b021fa1 | e5a0cc0f | b56f74e8 | 18acf3d6 | ce89e299 | b4a84fe0 | fd13e0b7 | 7cc43b81 | d2ada8d9 |
d0 | 165fa266 | 80957705 | 93cc7314 | 211a1477 | e6ad2065 | 77b5fa86 | c75442f5 | fb9d35cf | ebcdaf0c | 7b3e89a0 | d6411bd3 | ae1e7e49 | 00250e2d | 2071b35e | 226800bb | 57b8e0af |
e0 | 2464369b | f009b91e | 5563911d | 59dfa6aa | 78c14389 | d95a537f | 207d5ba2 | 02e5b9c5 | 83260376 | 6295cfa9 | 11c81968 | 4e734a41 | b3472dca | 7b14a94a | 1b510052 | 9a532915 |
f0 | d60f573f | bc9bc6e4 | 2b60a476 | 81e67400 | 08ba6fb5 | 571be91f | f296ec6b | 2a0dd915 | b6636521 | e7b9f9b6 | ff34052e | c5855664 | 53b02d5d | a99f8fa1 | 08ba4799 | 6e85076a |
S-Box 2 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | 4b7a70e9 | b5b32944 | db75092e | c4192623 | ad6ea6b0 | 49a7df7d | 9cee60b8 | 8fedb266 | ecaa8c71 | 699a17ff | 5664526c | c2b19ee1 | 193602a5 | 75094c29 | a0591340 | e4183a3e |
10 | 3f54989a | 5b429d65 | 6b8fe4d6 | 99f73fd6 | a1d29c07 | efe830f5 | 4d2d38e6 | f0255dc1 | 4cdd2086 | 8470eb26 | 6382e9c6 | 021ecc5e | 09686b3f | 3ebaefc9 | 3c971814 | 6b6a70a1 |
20 | 687f3584 | 52a0e286 | b79c5305 | aa500737 | 3e07841c | 7fdeae5c | 8e7d44ec | 5716f2b8 | b03ada37 | f0500c0d | f01c1f04 | 0200b3ff | ae0cf51a | 3cb574b2 | 25837a58 | dc0921bd |
30 | d19113f9 | 7ca92ff6 | 94324773 | 22f54701 | 3ae5e581 | 37c2dadc | c8b57634 | 9af3dda7 | a9446146 | 0fd0030e | ecc8c73e | a4751e41 | e238cd99 | 3bea0e2f | 3280bba1 | 183eb331 |
40 | 4e548b38 | 4f6db908 | 6f420d03 | f60a04bf | 2cb81290 | 24977c79 | 5679b072 | bcaf89af | de9a771f | d9930810 | b38bae12 | dccf3f2e | 5512721f | 2e6b7124 | 501adde6 | 9f84cd87 |
50 | 7a584718 | 7408da17 | bc9f9abc | e94b7d8c | ec7aec3a | db851dfa | 63094366 | c464c3d2 | ef1c1847 | 3215d908 | dd433b37 | 24c2ba16 | 12a14d43 | 2a65c451 | 50940002 | 133ae4dd |
60 | 71dff89e | 10314e55 | 81ac77d6 | 5f11199b | 043556f1 | d7a3c76b | 3c11183b | 5924a509 | f28fe6ed | 97f1fbfa | 9ebabf2c | 1e153c6e | 86e34570 | eae96fb1 | 860e5e0a | 5a3e2ab3 |
70 | 771fe71c | 4e3d06fa | 2965dcb9 | 99e71d0f | 803e89d6 | 5266c825 | 2e4cc978 | 9c10b36a | c6150eba | 94e2ea78 | a5fc3c53 | 1e0a2df4 | f2f74ea7 | 361d2b3d | 1939260f | 19c27960 |
80 | 5223a708 | f71312b6 | ebadfe6e | eac31f66 | e3bc4595 | a67bc883 | b17f37d1 | 018cff28 | c332ddef | be6c5aa5 | 65582185 | 68ab9802 | eecea50f | db2f953b | 2aef7dad | 5b6e2f84 |
90 | 1521b628 | 29076170 | ecdd4775 | 619f1510 | 13cca830 | eb61bd96 | 0334fe1e | aa0363cf | b5735c90 | 4c70a239 | d59e9e0b | cbaade14 | eecc86bc | 60622ca7 | 9cab5cab | b2f3846e |
a0 | 648b1eaf | 19bdf0ca | a02369b9 | 655abb50 | 40685a32 | 3c2ab4b3 | 319ee9d5 | c021b8f7 | 9b540b19 | 875fa099 | 95f7997e | 623d7da8 | f837889a | 97e32d77 | 11ed935f | 16681281 |
b0 | 0e358829 | c7e61fd6 | 96dedfa1 | 7858ba99 | 57f584a5 | 1b227263 | 9b83c3ff | 1ac24696 | cdb30aeb | 532e3054 | 8fd948e4 | 6dbc3128 | 58ebf2ef | 34c6ffea | fe28ed61 | ee7c3c73 |
c0 | 5d4a14d9 | e864b7e3 | 42105d14 | 203e13e0 | 45eee2b6 | a3aaabea | db6c4f15 | facb4fd0 | c742f442 | ef6abbb5 | 654f3b1d | 41cd2105 | d81e799e | 86854dc7 | e44b476a | 3d816250 |
d0 | cf62a1f2 | 5b8d2646 | fc8883a0 | c1c7b6a3 | 7f1524c3 | 69cb7492 | 47848a0b | 5692b285 | 095bbf00 | ad19489d | 1462b174 | 23820e00 | 58428d2a | 0c55f5ea | 1dadf43e | 233f7061 |
e0 | 3372f092 | 8d937e41 | d65fecf1 | 6c223bdb | 7cde3759 | cbee7460 | 4085f2a7 | ce77326e | a6078084 | 19f8509e | e8efd855 | 61d99735 | a969a7aa | c50c06c2 | 5a04abfc | 800bcadc |
f0 | 9e447a2e | c3453484 | fdd56705 | 0e1e9ec9 | db73dbd3 | 105588cd | 675fda79 | e3674340 | c5c43465 | 713e38d8 | 3d28f89e | f16dff20 | 153e21e7 | 8fb03d4a | e6e39f2b | db83adf7 |
S-Box 3 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | e93d5a68 | 948140f7 | f64c261c | 94692934 | 411520f7 | 7602d4f7 | bcf46b2e | d4a20068 | d4082471 | 3320f46a | 43b7d4b7 | 500061af | 1e39f62e | 97244546 | 14214f74 | bf8b8840 |
10 | 4d95fc1d | 96b591af | 70f4ddd3 | 66a02f45 | bfbc09ec | 03bd9785 | 7fac6dd0 | 31cb8504 | 96eb27b3 | 55fd3941 | da2547e6 | abca0a9a | 28507825 | 530429f4 | 0a2c86da | e9b66dfb |
20 | 68dc1462 | d7486900 | 680ec0a4 | 27a18dee | 4f3ffea2 | e887ad8c | b58ce006 | 7af4d6b6 | aace1e7c | d3375fec | ce78a399 | 406b2a42 | 20fe9e35 | d9f385b9 | ee39d7ab | 3b124e8b |
30 | 1dc9faf7 | 4b6d1856 | 26a36631 | eae397b2 | 3a6efa74 | dd5b4332 | 6841e7f7 | ca7820fb | fb0af54e | d8feb397 | 454056ac | ba489527 | 55533a3a | 20838d87 | fe6ba9b7 | d096954b |
40 | 55a867bc | a1159a58 | cca92963 | 99e1db33 | a62a4a56 | 3f3125f9 | 5ef47e1c | 9029317c | fdf8e802 | 04272f70 | 80bb155c | 05282ce3 | 95c11548 | e4c66d22 | 48c1133f | c70f86dc |
50 | 07f9c9ee | 41041f0f | 404779a4 | 5d886e17 | 325f51eb | d59bc0d1 | f2bcc18f | 41113564 | 257b7834 | 602a9c60 | dff8e8a3 | 1f636c1b | 0e12b4c2 | 02e1329e | af664fd1 | cad18115 |
60 | 6b2395e0 | 333e92e1 | 3b240b62 | eebeb922 | 85b2a20e | e6ba0d99 | de720c8c | 2da2f728 | d0127845 | 95b794fd | 647d0862 | e7ccf5f0 | 5449a36f | 877d48fa | c39dfd27 | f33e8d1e |
70 | 0a476341 | 992eff74 | 3a6f6eab | f4f8fd37 | a812dc60 | a1ebddf8 | 991be14c | db6e6b0d | c67b5510 | 6d672c37 | 2765d43b | dcd0e804 | f1290dc7 | cc00ffa3 | b5390f92 | 690fed0b |
80 | 667b9ffb | cedb7d9c | a091cf0b | d9155ea3 | bb132f88 | 515bad24 | 7b9479bf | 763bd6eb | 37392eb3 | cc115979 | 8026e297 | f42e312d | 6842ada7 | c66a2b3b | 12754ccc | 782ef11c |
90 | 6a124237 | b79251e7 | 06a1bbe6 | 4bfb6350 | 1a6b1018 | 11caedfa | 3d25bdd8 | e2e1c3c9 | 44421659 | 0a121386 | d90cec6e | d5abea2a | 64af674e | da86a85f | bebfe988 | 64e4c3fe |
a0 | 9dbc8057 | f0f7c086 | 60787bf8 | 6003604d | d1fd8346 | f6381fb0 | 7745ae04 | d736fccc | 83426b33 | f01eab71 | b0804187 | 3c005e5f | 77a057be | bde8ae24 | 55464299 | bf582e61 |
b0 | 4e58f48f | f2ddfda2 | f474ef38 | 8789bdc2 | 5366f9c3 | c8b38e74 | b475f255 | 46fcd9b9 | 7aeb2661 | 8b1ddf84 | 846a0e79 | 915f95e2 | 466e598e | 20b45770 | 8cd55591 | c902de4c |
c0 | b90bace1 | bb8205d0 | 11a86248 | 7574a99e | b77f19b6 | e0a9dc09 | 662d09a1 | c4324633 | e85a1f02 | 09f0be8c | 4a99a025 | 1d6efe10 | 1ab93d1d | 0ba5a4df | a186f20f | 2868f169 |
d0 | dcb7da83 | 573906fe | a1e2ce9b | 4fcd7f52 | 50115e01 | a70683fa | a002b5c4 | 0de6d027 | 9af88c27 | 773f8641 | c3604c06 | 61a806b5 | f0177a28 | c0f586e0 | 006058aa | 30dc7d62 |
e0 | 11e69ed7 | 2338ea63 | 53c2dd94 | c2c21634 | bbcbee56 | 90bcb6de | ebfc7da1 | ce591d76 | 6f05e409 | 4b7c0188 | 39720a3d | 7c927c24 | 86e3725f | 724d9db9 | 1ac15bb4 | d39eb8fc |
f0 | ed545578 | 08fca5b5 | d83d7cd3 | 4dad0fc4 | 1e50ef5e | b161e6f8 | a28514d9 | 6c51133c | 6fd5c7e7 | 56e14ec4 | 362abfce | ddc6c837 | d79a3234 | 92638212 | 670efa8e | 406000e0 |
S-Box 4 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | 3a39ce37 | d3faf5cf | abc27737 | 5ac52d1b | 5cb0679e | 4fa33742 | d3822740 | 99bc9bbe | d5118e9d | bf0f7315 | d62d1c7e | c700c47b | b78c1b6b | 21a19045 | b26eb1be | 6a366eb4 |
10 | 5748ab2f | bc946e79 | c6a376d2 | 6549c2c8 | 530ff8ee | 468dde7d | d5730a1d | 4cd04dc6 | 2939bbdb | a9ba4650 | ac9526e8 | be5ee304 | a1fad5f0 | 6a2d519a | 63ef8ce2 | 9a86ee22 |
20 | c089c2b8 | 43242ef6 | a51e03aa | 9cf2d0a4 | 83c061ba | 9be96a4d | 8fe51550 | ba645bd6 | 2826a2f9 | a73a3ae1 | 4ba99586 | ef5562e9 | c72fefd3 | f752f7da | 3f046f69 | 77fa0a59 |
30 | 80e4a915 | 87b08601 | 9b09e6ad | 3b3ee593 | e990fd5a | 9e34d797 | 2cf0b7d9 | 022b8b51 | 96d5ac3a | 017da67d | d1cf3ed6 | 7c7d2d28 | 1f9f25cf | adf2b89b | 5ad6b472 | 5a88f54c |
40 | e029ac71 | e019a5e6 | 47b0acfd | ed93fa9b | e8d3c48d | 283b57cc | f8d56629 | 79132e28 | 785f0191 | ed756055 | f7960e44 | e3d35e8c | 15056dd4 | 88f46dba | 03a16125 | 0564f0bd |
50 | c3eb9e15 | 3c9057a2 | 97271aec | a93a072a | 1b3f6d9b | 1e6321f5 | f59c66fb | 26dcf319 | 7533d928 | b155fdf5 | 03563482 | 8aba3cbb | 28517711 | c20ad9f8 | abcc5167 | ccad925f |
60 | 4de81751 | 3830dc8e | 379d5862 | 9320f991 | ea7a90c2 | fb3e7bce | 5121ce64 | 774fbe32 | a8b6e37e | c3293d46 | 48de5369 | 6413e680 | a2ae0810 | dd6db224 | 69852dfd | 09072166 |
70 | b39a460a | 6445c0dd | 586cdecf | 1c20c8ae | 5bbef7dd | 1b588d40 | ccd2017f | 6bb4e3bb | dda26a7e | 3a59ff45 | 3e350a44 | bcb4cdd5 | 72eacea8 | fa6484bb | 8d6612ae | bf3c6f47 |
80 | d29be463 | 542f5d9e | aec2771b | f64e6370 | 740e0d8d | e75b1357 | f8721671 | af537d5d | 4040cb08 | 4eb4e2cc | 34d2466a | 0115af84 | e1b00428 | 95983a1d | 06b89fb4 | ce6ea048 |
90 | 6f3f3b82 | 3520ab82 | 011a1d4b | 277227f8 | 611560b1 | e7933fdc | bb3a792b | 344525bd | a08839e1 | 51ce794b | 2f32c9b7 | a01fbac9 | e01cc87e | bcc7d1f6 | cf0111c3 | a1e8aac7 |
a0 | 1a908749 | d44fbd9a | d0dadecb | d50ada38 | 0339c32a | c6913667 | 8df9317c | e0b12b4f | f79e59b7 | 43f5bb3a | f2d519ff | 27d9459c | bf97222c | 15e6fc2a | 0f91fc71 | 9b941525 |
b0 | fae59361 | ceb69ceb | c2a86459 | 12baa8d1 | b6c1075e | e3056a0c | 10d25065 | cb03a442 | e0ec6e0e | 1698db3b | 4c98a0be | 3278e964 | 9f1f9532 | e0d392df | d3a0342b | 8971f21e |
c0 | 1b0a7441 | 4ba3348c | c5be7120 | c37632d8 | df359f8d | 9b992f2e | e60b6f47 | 0fe3f11d | e54cda54 | 1edad891 | ce6279cf | cd3e7e6f | 1618b166 | fd2c1d05 | 848fd2c5 | f6fb2299 |
d0 | f523f357 | a6327623 | 93a83531 | 56cccd02 | acf08162 | 5a75ebb5 | 6e163697 | 88d273cc | de966292 | 81b949d0 | 4c50901b | 71c65614 | e6c6c7bd | 327a140a | 45e1d006 | c3f27b9a |
e0 | c9aa53fd | 62a80f00 | bb25bfe2 | 35bdd2f6 | 71126905 | b2040222 | b6cbcf7c | cd769c2b | 53113ec0 | 1640e3d3 | 38abbd60 | 2547adf0 | ba38209c | f746ce76 | 77afa1c5 | 20756060 |
f0 | 85cbfe4e | 8ae88dd8 | 7aaaf9b0 | 4cf9aa7e | 1948c25c | 02fb8a8c | 01c36ae4 | d6ebe1f9 | 90d4f869 | a65cdea0 | 3f09252d | c208e69f | b74e6132 | ce77e25b | 578fdfe3 | 3ac372e6 |
This is the default setup for the blowfish cypher, but in order to actually encode anything, we must first apply our secret key.
Applying secret key
The blowfish cypher encodes data using a set of data tables (P array and S-Boxes). We could encode something with the data tables set up as they are, but that would require only knowledge of the blowfish cypher's default data tables to decode. So, we first select a secret phrase; Joe's not that creative, nor that concerned about security, so he chooses a password of 'password'. We convert that to ASCII (hex values), and arrive at 0x70617373776F7264. Using an actual passWORD for a blowfish key weakens the encryption, since you're self-limiting the possible values of the hex key to the range of 0x20-0x7E (94 possibilities), rather than 0x00-0xFF (256 possibilities), making a brute-force attack easier to accomplish.
Next we take that phrase and repeat it as often as necessary to match the size of the P array (hence the longest key that can be used with blowfish is 144 bits long, since that's the length of the P array):
Key: 70617373 776f7264 70617373 ... 70617373 776f7264 P array: 243f6a88 85a308d3 13198a2e ... 9216d5d9 8979fb1b
Then for each element of the P array, perform an exclusive-or (XOR) on the key and P element, arriving at a third element. Store this in the P array in place of the old element. In order to visualize this, we must expand the hexadecimal out to binary bits:
Key: 70617373 776f7264 ... 01110000011000010111001101110011 01110111011011110111001001100100 ... P array: 243f6a88 85a308d3 ... 00100100001111110110101010001000 10000101101000110000100011010011 ... XOR: 01010100010111100001100111111011 11110010100011000111101010110111 ... 545e19fb f2cc7ab7
The XOR result is a zero if both or neither of the input bits are zero, and is one if one and only one of the input bits is one. After XOR-ing the entire P array, the new P array looks like:
P Array | ||
---|---|---|
ID | Hex | Binary |
P1 | 545e19fb | 01010100010111100001100111111011 |
P2 | f2cc7ab7 | 11110010110011000111101010110111 |
P3 | 6378f95d | 01100011011110001111100101011101 |
P4 | 741f0120 | 01110100000111110000000100100000 |
P5 | d4684b51 | 11010100011010000100101101010001 |
P6 | 5ef043b4 | 01011110111100000100001110110100 |
P7 | 784f89eb | 01111000010011111000100111101011 |
P8 | 9b211eed | 10011011001000010001111011101101 |
P9 | 35495295 | 00110101010010010101001010010101 |
P10 | 4fbf6113 | 01001111101111110110000100010011 |
P11 | ce3515bc | 11001110001101010001010110111100 |
P12 | 43867e08 | 01000011100001100111111000001000 |
P13 | b0cd5ac4 | 10110000110011010101101011000100 |
P14 | be1322b9 | 10111110000100110010001010111001 |
P15 | 4fe5a6c6 | 01001111111001011010011011000110 |
P16 | c2287b73 | 11000010001010000111101101110011 |
P17 | e277a6aa | 11100010011101111010011010101010 |
P18 | fe16897f | 11111110000101101000100101111111 |
This is not the final values of the P array, but is an intermediary step to ensure that the next step is more random. To set up the final values of the P array and S-boxes for encryption, the new P array is used to generate the new values. This process is fairly repetitive and processor-intensive, and is one of blowfish's benefits, to resist brute-force attack. We must now take a 64-byte block of all zeroes (0x0000000000000000) and encrypt it using the standard blowfish method, using the new P array and original S-boxes.
To encode a 64-bit block, first the block is split in half, the highest-order bits being stored as the first input into the Left side of the Feistel structure (L0), and the lower-order bits being the Right side (R0). L0 is XORed with P1 and stored as R1, and fed through the F function. The F function splits the 32-bit input into four pieces. From highest to lowest, they get replaced with their values from S-box 1 through 4. Then the highest-order piece gets added to the second-highest piece (and bits higher than 32 get dropped), then XORed with the third piece, and finally added to the smallest piece (dropping bits higher than 32). That output from the F function is XORed with R0 and stored as L1. You now have L1 and R1; repeat the cycle until you have L14 and R14. On the last round, the halves don't change places, so L14 is XORed with P15, and is both passed through the F function to be XORed with R14, and is stored still as L14. Then L14 is XORed with P18 and R14 is XORed with P17, then re-merged into one 64-bit string to be the final encrypted string.
Put more concisely, Ri = Li-1 ⊕ Pi, Li = Ri-1 ⊕ F(Li-1 ⊕ Pi)
So, we start with L0 = 0x00000000, R0 = 0x00000000
L0 ⊕ P1 = 0x00000000 ⊕ 0x545e19fb = 0x545e19fb = R1
F(L0 ⊕ P1) = F(0x545e19fb)
Applying the F function to 0x545e19fb, it first gets split into four pieces, 0x54, 0x5e, 0x19, and 0xfb. Since each S-box has 256 entries, we can convert these pieces to decimal, and take that entry from the S-box as the new value. So, the 0x54th element of S-box 1 is 0x6eef0b6c, the 0x5e element from S-box 2 is 0x50940002, 0x19 from S-box 3 is 0x55fd3941, and 0xfb from S-box 4 is 0xc208e69f.
0x6eef0b6c + 0x50940002 = 0xbf830b6e
0xbf830b6e ⊕ 0x55fd3941 = 0xea7e322f
0xea7e322f + 0xc208e69f = 0xac8718ce
F(L0 ⊕ P1) = F(0x545e19fb) = 0xac8718ce
R0 ⊕ F(L0 ⊕ P1) = 0x00000000 ⊕ 0xac8718ce = 0xac8718ce = L1
Encoding L0 = 0x00000000, R0 = 0x00000000
L0 = 000000000000 = 0x00000000 = 0b00000000000000000000000000000000
B0 = 001415453179 = 0x545e19fb = 0b01010100010111100001100111111011
R1 = 001415453179 = 0x545e19fb = 0b01010100010111100001100111111011
R0 = 000000000000 = 0x00000000 = 0b00000000000000000000000000000000
F(R1) = -01400432434 = 0xac8718ce = 0b10101100100001110001100011001110
L1 = -01400432434 = 0xac8718ce = 0b10101100100001110001100011001110
After round 1, we end up with L1 = 0xac8718ce, R1 = 0x545e19fb
L1 = -01400432434 = 0xac8718ce = 0b10101100100001110001100011001110
B1 = -00221480265 = 0xf2cc7ab7 = 0b11110010110011000111101010110111
R2 = 001581998713 = 0x5e4b6279 = 0b01011110010010110110001001111001
R1 = 001415453179 = 0x545e19fb = 0b01010100010111100001100111111011
F(R2) = -01680740648 = 0x9bd1eed8 = 0b10011011110100011110111011011000
L2 = -00812648669 = 0xcf8ff723 = 0b11001111100011111111011100100011
After round 2, we end up with L2 = 0xcf8ff723, R2 = 0x5e4b6279
L2 = -00812648669 = 0xcf8ff723 = 0b11001111100011111111011100100011
B2 = 001668872541 = 0x6378f95d = 0b01100011011110001111100101011101
R3 = -01393095042 = 0xacf70e7e = 0b10101100111101110000111001111110
R2 = 001581998713 = 0x5e4b6279 = 0b01011110010010110110001001111001
F(R3) = 001590332444 = 0x5eca8c1c = 0b01011110110010101000110000011100
L3 = 000008515173 = 0x0081ee65 = 0b00000000100000011110111001100101
After round 3, we end up with L3 = 0x0081ee65, R3 = 0xacf70e7e
L3 = 000008515173 = 0x0081ee65 = 0b00000000100000011110111001100101
B3 = 001948188960 = 0x741f0120 = 0b01110100000111110000000100100000
R4 = 001956572997 = 0x749eef45 = 0b01110100100111101110111101000101
R3 = -01393095042 = 0xacf70e7e = 0b10101100111101110000111001111110
F(R4) = -01241158551 = 0xb6056c69 = 0b10110110000001010110110001101001
L4 = 000452092439 = 0x1af26217 = 0b00011010111100100110001000010111
After round 4, we end up with L4 = 0x1af26217, R4 = 0x749eef45
L4 = 000452092439 = 0x1af26217 = 0b00011010111100100110001000010111
B4 = -00731362479 = 0xd4684b51 = 0b11010100011010000100101101010001
R5 = -00828757690 = 0xce9a2946 = 0b11001110100110100010100101000110
R4 = 001956572997 = 0x749eef45 = 0b01110100100111101110111101000101
F(R5) = 002049633417 = 0x7a2aec89 = 0b01111010001010101110110010001001
L5 = 000246678476 = 0x0eb403cc = 0b00001110101101000000001111001100
After round 5, we end up with L5 = 0x0eb403cc, R5 = 0xce9a2946
L5 = 000246678476 = 0x0eb403cc = 0b00001110101101000000001111001100
B5 = 001592804276 = 0x5ef043b4 = 0b01011110111100000100001110110100
R6 = 001346650232 = 0x50444078 = 0b01010000010001000100000001111000
R5 = -00828757690 = 0xce9a2946 = 0b11001110100110100010100101000110
F(R6) = -01606140068 = 0xa0443f5c = 0b10100000010001000011111101011100
L6 = 001860048410 = 0x6ede161a = 0b01101110110111100001011000011010
After round 6, we end up with L6 = 0x6ede161a, R6 = 0x50444078
L6 = 001860048410 = 0x6ede161a = 0b01101110110111100001011000011010
B6 = 002018478571 = 0x784f89eb = 0b01111000010011111000100111101011
R7 = 000378642417 = 0x16919ff1 = 0b00010110100100011001111111110001
R6 = 001346650232 = 0x50444078 = 0b01010000010001000100000001111000
F(R7) = 000751141679 = 0x2cc5832f = 0b00101100110001011000001100101111
L7 = 002088878935 = 0x7c81c357 = 0b01111100100000011100001101010111
After round 7, we end up with L7 = 0x7c81c357, R7 = 0x16919ff1
L7 = 002088878935 = 0x7c81c357 = 0b01111100100000011100001101010111
B7 = -01692328211 = 0x9b211eed = 0b10011011001000010001111011101101
R8 = -00408887878 = 0xe7a0ddba = 0b11100111101000001101110110111010
R7 = 000378642417 = 0x16919ff1 = 0b00010110100100011001111111110001
F(R8) = -00199360686 = 0xf41dff52 = 0b11110100000111011111111101010010
L8 = -00494116701 = 0xe28c60a3 = 0b11100010100011000110000010100011
After round 8, we end up with L8 = 0xe28c60a3, R8 = 0xe7a0ddba
L8 = -00494116701 = 0xe28c60a3 = 0b11100010100011000110000010100011
B8 = 000893997717 = 0x35495295 = 0b00110101010010010101001010010101
R9 = -00674942410 = 0xd7c53236 = 0b11010111110001010011001000110110
R8 = -00408887878 = 0xe7a0ddba = 0b11100111101000001101110110111010
F(R9) = -00422232223 = 0xe6d53f61 = 0b11100110110101010011111101100001
L9 = 000024503003 = 0x0175e2db = 0b00000001011101011110001011011011
After round 9, we end up with L9 = 0x0175e2db, R9 = 0xd7c53236
L9 = 000024503003 = 0x0175e2db = 0b00000001011101011110001011011011
B9 = 001337942291 = 0x4fbf6113 = 0b01001111101111110110000100010011
R10 = 001321894856 = 0x4eca83c8 = 0b01001110110010101000001111001000
R9 = -00674942410 = 0xd7c53236 = 0b11010111110001010011001000110110
F(R10) = -00090479567 = 0xfa9b6431 = 0b11111010100110110110010000110001
L10 = 000761157127 = 0x2d5e5607 = 0b00101101010111100101011000000111
After round 10, we end up with L10 = 0x2d5e5607, R10 = 0x4eca83c8
L10 = 000761157127 = 0x2d5e5607 = 0b00101101010111100101011000000111
B10 = -00835381828 = 0xce3515bc = 0b11001110001101010001010110111100
R11 = -00479509573 = 0xe36b43bb = 0b11100011011010110100001110111011
R10 = 001321894856 = 0x4eca83c8 = 0b01001110110010101000001111001000
F(R11) = 000546185615 = 0x208e218f = 0b00100000100011100010000110001111
L11 = 001849991751 = 0x6e44a247 = 0b01101110010001001010001001000111
After round 11, we end up with L11 = 0x6e44a247, R11 = 0xe36b43bb
L11 = 001849991751 = 0x6e44a247 = 0b01101110010001001010001001000111
B11 = 001132887560 = 0x43867e08 = 0b01000011100001100111111000001000
R12 = 000767745103 = 0x2dc2dc4f = 0b00101101110000101101110001001111
R11 = -00479509573 = 0xe36b43bb = 0b11100011011010110100001110111011
F(R12) = 001408838988 = 0x53f92d4c = 0b01010011111110010010110101001100
L12 = -01332580617 = 0xb0926ef7 = 0b10110000100100100110111011110111
After round 12, we end up with L12 = 0xb0926ef7, R12 = 0x2dc2dc4f
L12 = -01332580617 = 0xb0926ef7 = 0b10110000100100100110111011110111
B12 = -01328719164 = 0xb0cd5ac4 = 0b10110000110011010101101011000100
R13 = 000006239283 = 0x005f3433 = 0b00000000010111110011010000110011
R12 = 000767745103 = 0x2dc2dc4f = 0b00101101110000101101110001001111
F(R13) = -00691232316 = 0xd6cca1c4 = 0b11010110110011001010000111000100
L13 = 000880880837 = 0x34812cc5 = 0b00110100100000010010110011000101
After round 13, we end up with L13 = 0x34812cc5, R13 = 0x005f3433
L13 = 000880880837 = 0x34812cc5 = 0b00110100100000010010110011000101
B13 = -01106042183 = 0xbe1322b9 = 0b10111110000100110010001010111001
R14 = -01970139524 = 0x8a920e7c = 0b10001010100100100000111001111100
R13 = 000006239283 = 0x005f3433 = 0b00000000010111110011010000110011
F(R14) = 001246352887 = 0x4a49d5f7 = 0b01001010010010011101010111110111
L14 = 001243013572 = 0x4a16e1c4 = 0b01001010000101101110000111000100
After round 14, we end up with L14 = 0x4a16e1c4, R14 = 0x8a920e7c
L14 = 001243013572 = 0x4a16e1c4 = 0b01001010000101101110000111000100
B14 = 001340450502 = 0x4fe5a6c6 = 0b01001111111001011010011011000110
R15 = 000099829506 = 0x05f34702 = 0b00000101111100110100011100000010
R14 = -01970139524 = 0x8a920e7c = 0b10001010100100100000111001111100
F(R15) = 000670604981 = 0x27f89eb5 = 0b00100111111110001001111010110101
L15 = 000515681574 = 0x1ebcad26 = 0b00011110101111001010110100100110
After round 15, we end up with L15 = 0x1ebcad26, R15 = 0x05f34702
L15 = 000515681574 = 0x1ebcad26 = 0b00011110101111001010110100100110
B15 = -01037534349 = 0xc2287b73 = 0b11000010001010000111101101110011
R16 = -00594225579 = 0xdc94d655 = 0b11011100100101001101011001010101
R15 = 000099829506 = 0x05f34702 = 0b00000101111100110100011100000010
F(R16) = -00766106226 = 0xd256258e = 0b11010010010101100010010110001110
L16 = -00677027188 = 0xd7a5628c = 0b11010111101001010110001010001100
After round 16, we end up with L16 = 0xd7a5628c, R16 = 0xdc94d655
After the final round, we end up with Lf = 0x22825f2a, Rf = 0x35d2c426.
So, the output from the blowfish encryption of 0x00000000 is 0x22825f2a35d2c426. This gets split in half and replaces the first two entries in the P array. Then that same output is fed in as input to the engine, and a new result is output, which will become the third and fourth entries in the P array. This continues until the P array is replaced, then S-box 1, through S-box 4. A total of 521 encodings needs to happen to generate enough data for this. After doing that whole process, the blowfish engine now looks like this:
P Array | ||
---|---|---|
ID | Hex | Binary |
P1 | 22825f2a | 00100010100000100101111100101010 |
P2 | 35d2c426 | 00110101110100101100010000100110 |
P3 | 8b00faf8 | 10001011000000001111101011111000 |
P4 | 4436d80e | 01000100001101101101100000001110 |
P5 | a401f60b | 10100100000000011111011000001011 |
P6 | 81764b11 | 10000001011101100100101100010001 |
P7 | 59a7e0eb | 01011001101001111110000011101011 |
P8 | e080dbfb | 11100000100000001101101111111011 |
P9 | 4a16af23 | 01001010000101101010111100100011 |
P10 | ef725173 | 11101111011100100101000101110011 |
P11 | 17b4b0cb | 00010111101101001011000011001011 |
P12 | 7fd72a5f | 01111111110101110010101001011111 |
P13 | e69c3e25 | 11100110100111000011111000100101 |
P14 | 99986c6c | 10011001100110000110110001101100 |
P15 | 38756c32 | 00111000011101010110110000110010 |
P16 | 4993c928 | 01001001100100111100100100101000 |
P17 | 216f4f75 | 00100001011011110100111101110101 |
P18 | 1fe1839f | 00011111111000011000001110011111 |
S-Box 1 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | 8f1bf4de | 6afcf373 | 530d0672 | cc500fee | d15186e5 | 52ffa039 | 4068d9db | 15cca20b | 9550a456 | d3f6ea7d | e9d7c012 | 0a6aeb9b | 31696572 | 98289b16 | b4c8b90a | 527a25a8 |
10 | 27a7f366 | de93f86b | 54605d6a | d90eb703 | af263733 | 884d5d38 | 4d7c7809 | 414ab9dd | 68419203 | 34d3a361 | f5dd5815 | 3708762a | 6e7cf951 | 2c1fc8bc | 8c81fa0c | 62645ac4 |
20 | e9f5c5d8 | 6ecd2d24 | 26a87f2e | cd8ae954 | 48ec79f3 | c12aaafd | c528f37a | 957738d1 | 8e3f72a7 | faa7f09f | 30bf7317 | bb459474 | 6fe01602 | 6582bfc1 | 78bcb25c | c09d0960 |
30 | 4a575e51 | 471bd0a6 | 9ac8497e | 4f3b992e | 11edd669 | 57464aee | 650349b9 | d0e536d5 | ec64ed79 | ba5375b7 | ecdabf11 | f81eef08 | 9d98bf8e | a2077b59 | 1fc0ec74 | d1d94580 |
40 | 8541c4bf | 9f9c8ab4 | c16ab27b | 051d5b97 | 0542bc8c | c014c4f8 | 98870fb4 | ff039d76 | 0f63f223 | cdef1780 | 797be101 | 38a1ed26 | 3905e93f | 57712410 | c2783058 | a285c8a1 |
50 | 7a0c5cb4 | 11c0d3c9 | 6c5c87b3 | 5002e78f | 8b779413 | c01ba952 | d1068203 | 713a6ab8 | 381820ff | d26dbfc4 | 4640c230 | d41afa0e | 83e8334c | a826f618 | 095674ff | 6e8273cd |
60 | c38290ab | 501de2c5 | befbbe82 | 94fa9ad8 | edda4143 | 070e6b8d | b6c1b978 | 3954ea11 | 1b8c14bf | 64e5dd2a | 3fecb7c5 | d6520cb4 | 540f28c8 | f89654c5 | fd3ae4dd | c0e7847b |
70 | 796b7294 | 608814ca | 5b91601e | 74c2b356 | 8a3a2543 | 89062cd5 | 2cbaa075 | e5139058 | 660ffe12 | c508e11d | 62aed28b | d184f34d | d9b0ff8d | 6a4bde64 | a8ff3a12 | 0bdfccb9 |
80 | d36df269 | 7de1b660 | b78743b7 | 0d53db8b | 78def122 | 36f470a2 | e542056e | b1adfe6d | 925c89c5 | 68d7db50 | 6aeb64e2 | d7b8cdb2 | 42f58337 | 9d8d92c7 | 40b846fa | 6075c78d |
90 | a1a0b5c1 | a77303e6 | 7e25fda5 | 08515093 | bd9a49ae | 7809c4df | 6f36d22f | 7480e282 | c30c1227 | 1e5c99de | 88d440a2 | b669d500 | f555458e | a53d9a9d | 6771b563 | 371a0315 |
a0 | ba7341a3 | b1b3bfe7 | 3fb779b7 | 3026f203 | a2ee7da4 | 461b3d8d | a1b5a7c9 | 80a70948 | 1d708751 | d88af935 | 7dd72366 | 42c7b89f | 9d73cc26 | ad4cb147 | 3f75ee6d | a45fd4e1 |
b0 | 53c0d9df | 78056001 | 2865b892 | dd9b4850 | 828735eb | 64ae5416 | 99c0f540 | 867786fa | 7385a93d | 81b92207 | af04024f | 0944282e | 08a1f35b | 7bc194a0 | e7ffeb8b | 2f153a2c |
c0 | bb5358f6 | e6a5edba | 61888a02 | 77fe657d | e593f4fd | 63af5c49 | 5e439b35 | 2d7edcae | 57be697b | 6f588d68 | 95c21e9c | 20f1e72d | f9272b05 | 3f2095c6 | 4b5e26f2 | 6c7170ea |
d0 | 5189ca10 | e3b2e4a7 | ad56a322 | 205c181b | 9b85c9f4 | 44ff0f3d | 2d98cc17 | 5280f51c | 1bc7b0be | dd98bc2d | 942ce6ab | 0822083e | 4181954c | 56212b29 | 7e0989c8 | 204e8610 |
e0 | 4aca5c33 | f4e5f885 | 68db3d7a | 89c92fb8 | edf06100 | 3a3feb69 | 4281ec6f | 93456700 | dcee7201 | 8145df7d | b4f7bfc1 | bb0ee36a | 7b16d5c6 | a338d107 | 4ea0d71e | ae609a82 |
f0 | f9f40930 | 0a65c1fd | a207ddbd | 0a0c317e | c941cef2 | ebc3971a | 320e4d40 | c7ba4692 | 52cc194b | 57240fa6 | 25e05efa | 74591991 | 53fb3999 | 5c76b9fd | 6b7dead2 | 41d2af51 |
S-Box 2 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | 12a52d1c | 5b7a25ff | a884d8cf | c35402db | 8cb310c4 | ddd576a7 | eeb968a3 | 2259d5e0 | 86947835 | 13ad5bd6 | ecfc1053 | 45b55f4c | 697be468 | 4932493e | 8044b62f | 7f966210 |
10 | 7773b364 | d6ac84d5 | 24869fe2 | b456b86c | d8813e21 | 589ee888 | d9a96836 | 442bdf7e | 58e58bd1 | d8ede1ca | 4dadf511 | 9bac2db8 | 57d61a15 | f2f80144 | 31d32fc8 | 48c1fd2d |
20 | 1cc4668b | 8f447173 | bca4d773 | cec82bc3 | 9433741c | 7b3e7194 | c47e40f3 | fadd0030 | 9a3723d6 | 120eb10a | 62ec8ba4 | bb174773 | 8154adfa | 6c3b0270 | 38845bf0 | 8a4be0bc |
30 | 41e97ad4 | 5fd82134 | 856168f7 | 58bbaf89 | cedf1aa5 | fd576da0 | 66a51bc6 | 29e83ad2 | 1eec25e6 | cd8c4011 | ff9c2663 | 401c70cd | f7d50623 | fd8752f8 | 8aad80fb | d9ed9b71 |
40 | b24a4130 | 873e45de | 63bd986c | 1d08ab87 | 797fe987 | 50d3da9c | be87744b | 404148cc | 95188019 | 4bd603aa | 6ac8d625 | 7bf3649a | 01b3f847 | d5158244 | dff7dc76 | 26a65150 |
50 | 9b1fc08d | f1fc0749 | e8d06e45 | 52ef893c | 294e8720 | 98f7339d | 46bcb798 | 1dd7c8a4 | 9d214279 | ab569799 | 69d1e352 | 81255d16 | b7e4f264 | c22cfbf2 | b4bec2b0 | ebf583e8 |
60 | a1418018 | 60a1a63d | d7797c8a | 782eb31a | 9d514f9b | 160af799 | 5acf58dd | 60aa2246 | 0014459b | 059660b3 | 2bda8703 | e8ce7a27 | a583761d | 2547f87e | ce7b51a7 | 0e074ba0 |
70 | 1d3dda6c | 950c9925 | c1a85293 | f03f0025 | 6bd03be3 | 83a42619 | fdb4c9cb | f7c78cc4 | 693c5c97 | 6168ada4 | 33b2da88 | 673b54e1 | b9293665 | ec3ef6e7 | 4569aaf8 | f6dae37d |
80 | 8ee10b0e | b58b2e4b | 85c70a2e | 0b17b3b2 | 34675b3a | 10b8662a | bc6e24d1 | c4f99a0f | d4effdf3 | 9c1a0343 | bf419ff2 | 7b51ea19 | 06ab177f | 33e3298f | 4091aaaa | 72820212 |
90 | 24380ec7 | 7572eb79 | 93bf2d8d | eebc3694 | 427575dd | 279ddef1 | 143c4e0b | 6246d993 | 558ce571 | 89cf30d4 | 1dc86d2b | a5549f74 | 585c3eb4 | 96286513 | 16b273d6 | ef360118 |
a0 | fdaff0e7 | 0bc24a47 | 022bd739 | 407e6c4f | ea2e9130 | e25a5539 | 10f4abc0 | 864a6415 | 32dcf3e7 | 17e20721 | c744cabd | 25dc1aed | a48e1927 | 7df4ec1a | 72e4987a | b5c887e4 |
b0 | c91db0b2 | e8186cf4 | d0711a22 | 44c63930 | b7264a17 | b9d14818 | e406e3a4 | db4d17e9 | 91e84c2c | 631e16b0 | 9750b2c8 | 5f0de1d7 | 5c2f9d9d | 3437457a | d4a432ad | fa3b9b8f |
c0 | 1ed19040 | cc4e3b3c | 825fa9eb | 70c7bd1a | a918030b | f6c7a581 | fec38ec6 | ea945e91 | 45081d84 | 13d5b7a2 | 43f3217d | 7c62e7db | e697f23c | 4ea419d6 | a4bd6f4d | 0686d738 |
d0 | ad9a2786 | 80b2b2f0 | e180a542 | 161c2bd2 | 2f7a905f | f598f51b | 8314ee3c | 4d0c9934 | 6980f744 | 65184ed4 | 5da27172 | 098de2e9 | 9ca54de5 | 1cfff68f | 9de21e54 | 3c3ea0d8 |
e0 | 9798071f | df1a9922 | 29afc100 | aee27c80 | 3312a5d0 | 3183f8eb | b6d9a954 | 340d51fd | 58b12b99 | 5f1d741c | 50c34fce | 8af66cf3 | 0df3ecc0 | ef1f8e06 | bde01981 | 830e7cd2 |
f0 | da7640c4 | d01c1d80 | 3f80afc7 | a21ed0a1 | dceaa6da | b3d98a83 | b1af8907 | 49873eba | 590f31ea | e2460c98 | 724290fe | 1475ced2 | 22ce7d8f | f946e4d4 | cafc9d03 | 370f5644 |
S-Box 3 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | 5b5170a1 | fe7b5d69 | 58942f0e | 8866aaac | 6bd6ffa6 | c91b4841 | 82ea75a7 | 9bf70993 | 2fc6fea2 | 20aac2c1 | 8f795318 | b63717a1 | 9e5b836e | 8a87b7bf | 6ba1afd3 | 171e40d9 |
10 | 4d907220 | fde1949a | db4bb387 | a1a1d128 | 84c62dbf | d7d4364f | f59a8c1c | f22848eb | 8466744b | ed93687d | 61fdc88a | 803ba653 | 834b3994 | df044006 | 300c611e | 0cd9897b |
20 | cfad65e2 | a437a709 | b0603e72 | 568802d9 | cb5e5d0b | 791f973a | 3b3d0c63 | 9df53862 | d8cbda39 | 9daff8ea | 58266847 | a9000a09 | 387f31cf | 07bf09a1 | b36ccfd1 | b1b249f0 |
30 | 42c2ce1d | 0102b869 | 233329d0 | d3815f3d | d7d84757 | d3871666 | 4476f945 | 25d78ddd | 69186472 | e6bad2ca | 47379c05 | 51853b8f | 6f0014b5 | df043cdb | 3339c584 | a2780b6f |
40 | 7cf5e480 | cd45c795 | aeefd4e5 | 932ca88b | 06241dbb | d2e6ec82 | aa6f0c0a | e6cd58b9 | cd160940 | b4fd4d95 | 88021ab6 | 6cd78792 | 22f08f6b | e5a07755 | 8e931856 | dc319e0c |
50 | bcdab434 | d7bc3a14 | 09b74fc4 | 8a84ff93 | f7ab1f41 | 2ecb5c06 | b0064c78 | a9417041 | 18ba90a5 | 44880aaa | 4fc36306 | 14779274 | fed41422 | a3a3160e | 6bcb5592 | 281d40d6 |
60 | cc9a4629 | 7803312c | 2558d5ce | 30db13b7 | fd5a54bf | 239f2a0b | e048d8c4 | a9ead425 | 47b0c903 | 50a1b98c | 67c15f9d | 4ba7a43f | 871c0fbb | be53080e | 958715d1 | 36718bae |
70 | 74b7c7ba | 7c21460a | 452a6abf | 71b955b5 | 1584d7dd | c5d7b370 | 1698107d | da6605f8 | b90ef1f1 | 39fdbf18 | b6c25665 | 72f932af | 59769976 | 90698513 | ef255500 | d83ec494 |
80 | 1ba574a3 | ee17533c | cc001c0c | 7064a7e2 | 0a345e3f | dcb9560f | 4eeb6efc | 99c6691d | 1bc878bd | d8bafdc7 | d528a57b | 030c89fa | a05ef005 | 512ca097 | e9349370 | 46020c17 |
90 | d15c12d8 | da7738bc | 47950b1c | b50f8fd8 | 3a44caa9 | e7de73db | eaa58b32 | b8de2e1b | 18778516 | 593cd530 | 7538078d | 5daaa7bd | 5955cfaf | 92fd2c58 | 7fdc00b2 | 2ad80e87 |
a0 | 8dc1b490 | 082bc577 | cc358bca | 73659d85 | 09a9beb8 | ede23c19 | fb53c77c | 629a5482 | 6bc09b19 | 4db94594 | 133bdb92 | ef914a03 | 3fce3c29 | 1b8443ef | 930131c9 | dcba8265 |
b0 | b7faef2d | 349de478 | 9c64e10d | af8b4375 | 39c5dcee | 8f01af1a | f650fbe7 | b9e423df | 61eee38d | 6ea3b6f3 | 3e2a0800 | f93e5f4a | a4a4f365 | d3b0244e | fb5ef787 | e797fc6c |
c0 | 3c11e456 | a8cc069b | 1386adc4 | 051f6431 | f3638616 | 637da5ef | 376fe1fd | e10d0b64 | e4b7d44a | 47d3379a | ba8f3343 | 181c32c1 | 0d11f3e7 | bd1a7730 | 87899f72 | c2ff913a |
d0 | 565d920b | 844bc84b | 6a89b6b2 | a2b64e12 | 0724e395 | 5e2ebf11 | 95705a3b | 5807297f | 70d2466e | d8db6b5a | 400a16bd | 22f7172c | 388b8248 | 728ffc68 | a950e3a0 | 5426457c |
e0 | 075525fd | fab1c24c | e19e64fc | 2bfdc731 | b0dde195 | 4faa8069 | 1780764d | c08ef0a5 | d69cc341 | 09cec674 | 66b7604e | 10b30dcf | ee39cbb8 | 5f3f0bad | 2f858969 | 74a021a1 |
f0 | 0853e86b | 28b6ce10 | b1e3d731 | 92ced8dd | da20723d | 19ae0c66 | 0d9b38db | f714fdbd | dade449a | 406695d9 | 5b2f6b5f | a61bfbda | 6beccea7 | 5c5268e1 | 462ceaea | 35aa3998 |
S-Box 4 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | |
00 | a3c644b4 | b5a0d38b | aa0adbfd | f7b04356 | eca52ec1 | f1e441b9 | b012d435 | 6a971fc5 | 64555c63 | 693f8d24 | ed68f6e1 | 63a14362 | d4588844 | 94b2ca82 | 7e69b0ca | 6f8f74e4 |
10 | 278a2f80 | ded65424 | b998a8c8 | 66f87cc7 | 2baa8e22 | a9b7bc19 | a698d2f4 | ace6686e | 03546161 | da208e35 | 36846c42 | 0401feec | 9fdf44c1 | 426b3aae | 79e4378a | 2b5055ed |
20 | f15aefd4 | d0ded026 | dd5d8e75 | a50cd553 | f8bfab22 | 1e83761a | 9ca888b3 | a263d6fc | 969ae336 | 4b04e139 | 6a5a5132 | e2caef8b | 77825798 | 97ca5722 | ebd90a9f | eb8ea1a0 |
30 | b770ecf6 | 56f63550 | 711df826 | a48b182d | 2bafcd74 | 01e26966 | 74a862be | f7e2240e | 776e2c0d | 77230d5c | 541c2304 | e33d8530 | d4621f34 | 6af84f83 | 041857ad | bf63fc37 |
40 | 718372aa | 10a261a6 | 03cea438 | dde1ff93 | 7850dcef | 5f78f368 | 1bc505d0 | 37f975ae | 77a6f2f4 | 60d7ad9a | 3557e0f0 | 46231504 | 1ee46768 | 030817c3 | a2f2a660 | 651d0313 |
50 | 46e04d50 | 33249910 | 44b20f81 | 5039e28a | 566dcee3 | 249a90e5 | 7e1ae12d | abcf3010 | e0fa59d6 | 6eff54a7 | 4286c102 | 585a35bc | bfc85b84 | 1e38eb9e | d8ba38f0 | b3ed81e8 |
60 | bfad0cc1 | 7b53be2c | b97a698c | f7f07b0b | ee29c1b5 | fd22df28 | 08e26f00 | a3a59e94 | ccb193ee | 598b0709 | 1c0f6a2a | 8b8505ca | c4349fcd | 07320ebc | c5c8bcbe | 0801bec2 |
70 | 06b14c58 | 7971c458 | 76dd3664 | e95afb74 | d6df0d78 | 37de6dce | ed75d50b | 7e55d4b1 | b97d0077 | fb98b219 | 1ad49b06 | 41bfbfba | 75a1bd95 | 91f2dd9c | 8d96d9ff | b79ca196 |
80 | 134de081 | 30000100 | de10076a | da66dd22 | 9c86012a | db657a4e | 55eda87f | 688f4b91 | 694350d3 | 37909eba | d4c3a6a8 | e8769762 | f55067e2 | 2b82509d | a9c8e589 | d6ef3573 |
90 | 48f94f37 | 632d0516 | 9ad37f62 | c6644992 | b3230230 | b5d2428c | b3bd5d30 | 93d2443c | c7154f32 | 626887a4 | 695c2f29 | bcbc1c71 | 507afce3 | 01385656 | bcdf0f86 | fd6530aa |
a0 | a207ee07 | 8888e5fa | 6bb3bfd8 | 817946ec | bc18a3ee | e459227a | d52d1ef7 | 251ee355 | 2ffb3faf | 323aa5de | 2b7adadd | 60c21f3d | 75b5d519 | 6854b58b | 3b003c4c | c2e59a47 |
b0 | c6844a04 | 1ce03228 | bb52d2cf | 7a7663d2 | 43003d99 | 41ef977e | 22a083ff | 9628df77 | 318a4011 | 82e8ca18 | a6715025 | 9ca05873 | 98f21d05 | e9bf1560 | 6e4fbdd9 | f9a0de78 |
c0 | 1096374e | 7ce9206c | ef836d20 | 2f5721a4 | afc8933d | 168a6079 | 55249587 | 6f5db247 | 79cb04eb | 6fcab979 | 44783948 | b4e8a5ed | 189364b2 | 5cd7d94e | e168b431 | 01f6b111 |
d0 | c6bf951c | 6cfae730 | 900d3657 | 5a5e57aa | 929c36a6 | 46934158 | e633d4e9 | 4bf0c01a | 102affd0 | 849f14c8 | 3e0d4718 | 6bbe76c5 | 823b4912 | a31703de | fa9ed824 | dd5fb43a |
e0 | e267d746 | 606cd00f | 87704586 | 3c90e9cf | 1a96cb82 | 42e5fecf | 2c1df5e9 | 443ed6db | e37cebb2 | 5ba0d89d | 4bfd86bd | 9e2b205f | fee50b60 | dd72f762 | c56a6ad7 | d92a5c79 |
f0 | 862d72aa | 66755ced | f6a91396 | cd8def43 | 271fbfe7 | 05407395 | 0250cdfb | 3bfae8e9 | 509d9d26 | 34baa109 | eb37f97b | ebc2a00f | a613e810 | 6ad052a0 | 213563a2 | fd05358e |
Now, with this data, we are ready to encode data. Once this set of data has been generated, it can be used to encode and decode data.
Encode data
Encoding data is done in 64-byte blocks, the same as during the key generation. Now Joe wants to encode the text message "I love Sue.". First that text gets converted to its ASCII format (hex) to arrive at 0x49206c6f7665205375652e. This has to be broken into 64-byte blocks, so we have to encode 0x49206c6f76652053 and 0x75652e0000000000 separately.
enc(0x49206c6f76652053) = 0x69792f41cf50b1bc
enc(0x75652e0000000000) = 0xe5e162589cc68432
Decode data
Now Sue (quite different than Joe), is quite the smart cookie, and pretty well versed at social engineering, so knows that Joe often picks a password of 'password', so can generate the blowfish data necessary to encode/decode Joe's messages without any other input from him. Taking a peek on his computer (his user account there also has a password of 'password'), she finds the encoded text file with data of 0x754dc5f20737dafafffc0dd9181261a4. In order to decode this content, the process is exactly the same as encryption, except the P array is used in the reverse order.
dec(0x754dc5f20737dafa) = 0x49206c6f76652053
dec(0xfffc0dd9181261a4) = 0x75652e0000000000