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:

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
IDHexBinary
P1243f6a8800100100001111110110101010001000
P285a308d310000101101000110000100011010011
P313198a2e00010011000110011000101000101110
P40370734400000011011100000111001101000100
P5a409382210100100000010010011100000100010
P6299f31d000101001100111110011000111010000
P7082efa9800001000001011101111101010011000
P8ec4e6c8911101100010011100110110010001001
P9452821e601000101001010000010000111100110
P1038d0137700111000110100000001001101110111
P11be5466cf10111110010101000110011011001111
P1234e90c6c00110100111010010000110001101100
P13c0ac29b711000000101011000010100110110111
P14c97c50dd11001001011111000101000011011101
P153f84d5b500111111100001001101010110110101
P16b547091710110101010001110000100100010111
P179216d5d910010010000101101101010111011001
P188979fb1b10001001011110011111101100011011
S-Box 1
 0123456789abcdef
00d1310ba698dfb5ac2ffd72dbd01adfb7b8e1afed6a267e96ba7c9045f12c7f9924a19947b3916cf70801f2e2858efc16636920d871574e69a458fea3f4933d7e
100d95748f728eb658718bcd5882154aee7b54a41dc25a59b59c30d5392af26013c5d1b023286085f0ca417918b8db38ef8e79dcb0603a180e6c9e0e8bb01e8a3e
20d71577c1bd314b2778af2fda55605c60e65525f3aa55ab945748986263e8144055ca396a2aab10b6b4cc5c341141e8cea15486af7c72e993b3ee1411636fbc2a
302ba9c55d741831f6ce5c3e169b87931eafd6ba336c24cf5c7a325381289586773b8f48986b4bb9afc4bfe81b6628219361d809ccfb21a991487cac605dec8032
40ef845d5de98575b1dc262302eb651b8823893e81d396acc50f6d6ff383f442392e0b4482a484200469c8f04a9e1f9b5e21c66842f6e96c9a670c9c61abd388f0
506a51a0d2d8542f68960fa728ab5133a36eef0b6c137a3be4ba3bf0507efb2a98a1f1651d39af017666ca593e82430e888cee8619456f9fb47d84a5c33b8b5ebe
60e06f75d885c12073401a449f56c16aa64ed3aa62363f77061bfedf72429b023d37d0d724d00a1248db0fead349f1c09b075372c980991b7b25d479d8f6e8def7
70e3fe501ab6794c3b976ce0bd04c006bac1a94fb6409f60c45e5c9ec2196a246368fb6faf3e6c53b51339b2eb3b52ec6f6dfc511f9b30952ccc814544af5ebd09
80bee3d004de334afd660f2807192e4bb3c0cba85745c8740fd20b5f39b9d3fbdb5579c0bd1a60320ad6a100c6402c7279679f25fefb1fa3cc8ea5e9f8db3222f8
903c7516dffd616b152f501ec8ad0552ab323db5fafd23876053317b483e00df829e5c57bbca6f8ca01a87562edf1769dbd542a8f6287effc3ac6732c68c4f5573
a0695b27b0bbca58c8e1ffa35db8f011a010fa3d98fd2183b84afcb56c2dd1d35b9a53e479b6f84565d28e49bc4bfb9790e1ddf2daa4cb7e3362fb1341cee4c6e8
b0ef20cada36774c01d07e9efe2bf11fb495dbda4dae909198eaad8e716b93d5a0d08ed1d0afc725e08e3c5b2f8e7594b78ff6e2fbf2122b648888b812900df01c
c04fad5ea0688fc31cd1cff191b3a8c1ad2f2f2218be0e1777ea752dfe8b021fa1e5a0cc0fb56f74e818acf3d6ce89e299b4a84fe0fd13e0b77cc43b81d2ada8d9
d0165fa2668095770593cc7314211a1477e6ad206577b5fa86c75442f5fb9d35cfebcdaf0c7b3e89a0d6411bd3ae1e7e4900250e2d2071b35e226800bb57b8e0af
e02464369bf009b91e5563911d59dfa6aa78c14389d95a537f207d5ba202e5b9c5832603766295cfa911c819684e734a41b3472dca7b14a94a1b5100529a532915
f0d60f573fbc9bc6e42b60a47681e6740008ba6fb5571be91ff296ec6b2a0dd915b6636521e7b9f9b6ff34052ec585566453b02d5da99f8fa108ba47996e85076a
S-Box 2
 0123456789abcdef
004b7a70e9b5b32944db75092ec4192623ad6ea6b049a7df7d9cee60b88fedb266ecaa8c71699a17ff5664526cc2b19ee1193602a575094c29a0591340e4183a3e
103f54989a5b429d656b8fe4d699f73fd6a1d29c07efe830f54d2d38e6f0255dc14cdd20868470eb266382e9c6021ecc5e09686b3f3ebaefc93c9718146b6a70a1
20687f358452a0e286b79c5305aa5007373e07841c7fdeae5c8e7d44ec5716f2b8b03ada37f0500c0df01c1f040200b3ffae0cf51a3cb574b225837a58dc0921bd
30d19113f97ca92ff69432477322f547013ae5e58137c2dadcc8b576349af3dda7a94461460fd0030eecc8c73ea4751e41e238cd993bea0e2f3280bba1183eb331
404e548b384f6db9086f420d03f60a04bf2cb8129024977c795679b072bcaf89afde9a771fd9930810b38bae12dccf3f2e5512721f2e6b7124501adde69f84cd87
507a5847187408da17bc9f9abce94b7d8cec7aec3adb851dfa63094366c464c3d2ef1c18473215d908dd433b3724c2ba1612a14d432a65c45150940002133ae4dd
6071dff89e10314e5581ac77d65f11199b043556f1d7a3c76b3c11183b5924a509f28fe6ed97f1fbfa9ebabf2c1e153c6e86e34570eae96fb1860e5e0a5a3e2ab3
70771fe71c4e3d06fa2965dcb999e71d0f803e89d65266c8252e4cc9789c10b36ac6150eba94e2ea78a5fc3c531e0a2df4f2f74ea7361d2b3d1939260f19c27960
805223a708f71312b6ebadfe6eeac31f66e3bc4595a67bc883b17f37d1018cff28c332ddefbe6c5aa56558218568ab9802eecea50fdb2f953b2aef7dad5b6e2f84
901521b62829076170ecdd4775619f151013cca830eb61bd960334fe1eaa0363cfb5735c904c70a239d59e9e0bcbaade14eecc86bc60622ca79cab5cabb2f3846e
a0648b1eaf19bdf0caa02369b9655abb5040685a323c2ab4b3319ee9d5c021b8f79b540b19875fa09995f7997e623d7da8f837889a97e32d7711ed935f16681281
b00e358829c7e61fd696dedfa17858ba9957f584a51b2272639b83c3ff1ac24696cdb30aeb532e30548fd948e46dbc312858ebf2ef34c6ffeafe28ed61ee7c3c73
c05d4a14d9e864b7e342105d14203e13e045eee2b6a3aaabeadb6c4f15facb4fd0c742f442ef6abbb5654f3b1d41cd2105d81e799e86854dc7e44b476a3d816250
d0cf62a1f25b8d2646fc8883a0c1c7b6a37f1524c369cb749247848a0b5692b285095bbf00ad19489d1462b17423820e0058428d2a0c55f5ea1dadf43e233f7061
e03372f0928d937e41d65fecf16c223bdb7cde3759cbee74604085f2a7ce77326ea607808419f8509ee8efd85561d99735a969a7aac50c06c25a04abfc800bcadc
f09e447a2ec3453484fdd567050e1e9ec9db73dbd3105588cd675fda79e3674340c5c43465713e38d83d28f89ef16dff20153e21e78fb03d4ae6e39f2bdb83adf7
S-Box 3
 0123456789abcdef
00e93d5a68948140f7f64c261c94692934411520f77602d4f7bcf46b2ed4a20068d40824713320f46a43b7d4b7500061af1e39f62e9724454614214f74bf8b8840
104d95fc1d96b591af70f4ddd366a02f45bfbc09ec03bd97857fac6dd031cb850496eb27b355fd3941da2547e6abca0a9a28507825530429f40a2c86dae9b66dfb
2068dc1462d7486900680ec0a427a18dee4f3ffea2e887ad8cb58ce0067af4d6b6aace1e7cd3375fecce78a399406b2a4220fe9e35d9f385b9ee39d7ab3b124e8b
301dc9faf74b6d185626a36631eae397b23a6efa74dd5b43326841e7f7ca7820fbfb0af54ed8feb397454056acba48952755533a3a20838d87fe6ba9b7d096954b
4055a867bca1159a58cca9296399e1db33a62a4a563f3125f95ef47e1c9029317cfdf8e80204272f7080bb155c05282ce395c11548e4c66d2248c1133fc70f86dc
5007f9c9ee41041f0f404779a45d886e17325f51ebd59bc0d1f2bcc18f41113564257b7834602a9c60dff8e8a31f636c1b0e12b4c202e1329eaf664fd1cad18115
606b2395e0333e92e13b240b62eebeb92285b2a20ee6ba0d99de720c8c2da2f728d012784595b794fd647d0862e7ccf5f05449a36f877d48fac39dfd27f33e8d1e
700a476341992eff743a6f6eabf4f8fd37a812dc60a1ebddf8991be14cdb6e6b0dc67b55106d672c372765d43bdcd0e804f1290dc7cc00ffa3b5390f92690fed0b
80667b9ffbcedb7d9ca091cf0bd9155ea3bb132f88515bad247b9479bf763bd6eb37392eb3cc1159798026e297f42e312d6842ada7c66a2b3b12754ccc782ef11c
906a124237b79251e706a1bbe64bfb63501a6b101811caedfa3d25bdd8e2e1c3c9444216590a121386d90cec6ed5abea2a64af674eda86a85fbebfe98864e4c3fe
a09dbc8057f0f7c08660787bf86003604dd1fd8346f6381fb07745ae04d736fccc83426b33f01eab71b08041873c005e5f77a057bebde8ae2455464299bf582e61
b04e58f48ff2ddfda2f474ef388789bdc25366f9c3c8b38e74b475f25546fcd9b97aeb26618b1ddf84846a0e79915f95e2466e598e20b457708cd55591c902de4c
c0b90bace1bb8205d011a862487574a99eb77f19b6e0a9dc09662d09a1c4324633e85a1f0209f0be8c4a99a0251d6efe101ab93d1d0ba5a4dfa186f20f2868f169
d0dcb7da83573906fea1e2ce9b4fcd7f5250115e01a70683faa002b5c40de6d0279af88c27773f8641c3604c0661a806b5f0177a28c0f586e0006058aa30dc7d62
e011e69ed72338ea6353c2dd94c2c21634bbcbee5690bcb6deebfc7da1ce591d766f05e4094b7c018839720a3d7c927c2486e3725f724d9db91ac15bb4d39eb8fc
f0ed54557808fca5b5d83d7cd34dad0fc41e50ef5eb161e6f8a28514d96c51133c6fd5c7e756e14ec4362abfceddc6c837d79a323492638212670efa8e406000e0
S-Box 4
 0123456789abcdef
003a39ce37d3faf5cfabc277375ac52d1b5cb0679e4fa33742d382274099bc9bbed5118e9dbf0f7315d62d1c7ec700c47bb78c1b6b21a19045b26eb1be6a366eb4
105748ab2fbc946e79c6a376d26549c2c8530ff8ee468dde7dd5730a1d4cd04dc62939bbdba9ba4650ac9526e8be5ee304a1fad5f06a2d519a63ef8ce29a86ee22
20c089c2b843242ef6a51e03aa9cf2d0a483c061ba9be96a4d8fe51550ba645bd62826a2f9a73a3ae14ba99586ef5562e9c72fefd3f752f7da3f046f6977fa0a59
3080e4a91587b086019b09e6ad3b3ee593e990fd5a9e34d7972cf0b7d9022b8b5196d5ac3a017da67dd1cf3ed67c7d2d281f9f25cfadf2b89b5ad6b4725a88f54c
40e029ac71e019a5e647b0acfded93fa9be8d3c48d283b57ccf8d5662979132e28785f0191ed756055f7960e44e3d35e8c15056dd488f46dba03a161250564f0bd
50c3eb9e153c9057a297271aeca93a072a1b3f6d9b1e6321f5f59c66fb26dcf3197533d928b155fdf5035634828aba3cbb28517711c20ad9f8abcc5167ccad925f
604de817513830dc8e379d58629320f991ea7a90c2fb3e7bce5121ce64774fbe32a8b6e37ec3293d4648de53696413e680a2ae0810dd6db22469852dfd09072166
70b39a460a6445c0dd586cdecf1c20c8ae5bbef7dd1b588d40ccd2017f6bb4e3bbdda26a7e3a59ff453e350a44bcb4cdd572eacea8fa6484bb8d6612aebf3c6f47
80d29be463542f5d9eaec2771bf64e6370740e0d8de75b1357f8721671af537d5d4040cb084eb4e2cc34d2466a0115af84e1b0042895983a1d06b89fb4ce6ea048
906f3f3b823520ab82011a1d4b277227f8611560b1e7933fdcbb3a792b344525bda08839e151ce794b2f32c9b7a01fbac9e01cc87ebcc7d1f6cf0111c3a1e8aac7
a01a908749d44fbd9ad0dadecbd50ada380339c32ac69136678df9317ce0b12b4ff79e59b743f5bb3af2d519ff27d9459cbf97222c15e6fc2a0f91fc719b941525
b0fae59361ceb69cebc2a8645912baa8d1b6c1075ee3056a0c10d25065cb03a442e0ec6e0e1698db3b4c98a0be3278e9649f1f9532e0d392dfd3a0342b8971f21e
c01b0a74414ba3348cc5be7120c37632d8df359f8d9b992f2ee60b6f470fe3f11de54cda541edad891ce6279cfcd3e7e6f1618b166fd2c1d05848fd2c5f6fb2299
d0f523f357a632762393a8353156cccd02acf081625a75ebb56e16369788d273ccde96629281b949d04c50901b71c65614e6c6c7bd327a140a45e1d006c3f27b9a
e0c9aa53fd62a80f00bb25bfe235bdd2f671126905b2040222b6cbcf7ccd769c2b53113ec01640e3d338abbd602547adf0ba38209cf746ce7677afa1c520756060
f085cbfe4e8ae88dd87aaaf9b04cf9aa7e1948c25c02fb8a8c01c36ae4d6ebe1f990d4f869a65cdea03f09252dc208e69fb74e6132ce77e25b578fdfe33ac372e6

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
IDHexBinary
P1545e19fb01010100010111100001100111111011
P2f2cc7ab711110010110011000111101010110111
P36378f95d01100011011110001111100101011101
P4741f012001110100000111110000000100100000
P5d4684b5111010100011010000100101101010001
P65ef043b401011110111100000100001110110100
P7784f89eb01111000010011111000100111101011
P89b211eed10011011001000010001111011101101
P93549529500110101010010010101001010010101
P104fbf611301001111101111110110000100010011
P11ce3515bc11001110001101010001010110111100
P1243867e0801000011100001100111111000001000
P13b0cd5ac410110000110011010101101011000100
P14be1322b910111110000100110010001010111001
P154fe5a6c601001111111001011010011011000110
P16c2287b7311000010001010000111101101110011
P17e277a6aa11100010011101111010011010101010
P18fe16897f11111110000101101000100101111111

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 = 0x000000000x545e19fb = 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
0xbf830b6e0x55fd3941 = 0xea7e322f
0xea7e322f + 0xc208e69f = 0xac8718ce
F(L0 ⊕ P1) = F(0x545e19fb) = 0xac8718ce

R0 ⊕ F(L0 ⊕ P1) = 0x000000000xac8718ce = 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
IDHexBinary
P122825f2a00100010100000100101111100101010
P235d2c42600110101110100101100010000100110
P38b00faf810001011000000001111101011111000
P44436d80e01000100001101101101100000001110
P5a401f60b10100100000000011111011000001011
P681764b1110000001011101100100101100010001
P759a7e0eb01011001101001111110000011101011
P8e080dbfb11100000100000001101101111111011
P94a16af2301001010000101101010111100100011
P10ef72517311101111011100100101000101110011
P1117b4b0cb00010111101101001011000011001011
P127fd72a5f01111111110101110010101001011111
P13e69c3e2511100110100111000011111000100101
P1499986c6c10011001100110000110110001101100
P1538756c3200111000011101010110110000110010
P164993c92801001001100100111100100100101000
P17216f4f7500100001011011110100111101110101
P181fe1839f00011111111000011000001110011111
S-Box 1
 0123456789abcdef
008f1bf4de6afcf373530d0672cc500feed15186e552ffa0394068d9db15cca20b9550a456d3f6ea7de9d7c0120a6aeb9b3169657298289b16b4c8b90a527a25a8
1027a7f366de93f86b54605d6ad90eb703af263733884d5d384d7c7809414ab9dd6841920334d3a361f5dd58153708762a6e7cf9512c1fc8bc8c81fa0c62645ac4
20e9f5c5d86ecd2d2426a87f2ecd8ae95448ec79f3c12aaafdc528f37a957738d18e3f72a7faa7f09f30bf7317bb4594746fe016026582bfc178bcb25cc09d0960
304a575e51471bd0a69ac8497e4f3b992e11edd66957464aee650349b9d0e536d5ec64ed79ba5375b7ecdabf11f81eef089d98bf8ea2077b591fc0ec74d1d94580
408541c4bf9f9c8ab4c16ab27b051d5b970542bc8cc014c4f898870fb4ff039d760f63f223cdef1780797be10138a1ed263905e93f57712410c2783058a285c8a1
507a0c5cb411c0d3c96c5c87b35002e78f8b779413c01ba952d1068203713a6ab8381820ffd26dbfc44640c230d41afa0e83e8334ca826f618095674ff6e8273cd
60c38290ab501de2c5befbbe8294fa9ad8edda4143070e6b8db6c1b9783954ea111b8c14bf64e5dd2a3fecb7c5d6520cb4540f28c8f89654c5fd3ae4ddc0e7847b
70796b7294608814ca5b91601e74c2b3568a3a254389062cd52cbaa075e5139058660ffe12c508e11d62aed28bd184f34dd9b0ff8d6a4bde64a8ff3a120bdfccb9
80d36df2697de1b660b78743b70d53db8b78def12236f470a2e542056eb1adfe6d925c89c568d7db506aeb64e2d7b8cdb242f583379d8d92c740b846fa6075c78d
90a1a0b5c1a77303e67e25fda508515093bd9a49ae7809c4df6f36d22f7480e282c30c12271e5c99de88d440a2b669d500f555458ea53d9a9d6771b563371a0315
a0ba7341a3b1b3bfe73fb779b73026f203a2ee7da4461b3d8da1b5a7c980a709481d708751d88af9357dd7236642c7b89f9d73cc26ad4cb1473f75ee6da45fd4e1
b053c0d9df780560012865b892dd9b4850828735eb64ae541699c0f540867786fa7385a93d81b92207af04024f0944282e08a1f35b7bc194a0e7ffeb8b2f153a2c
c0bb5358f6e6a5edba61888a0277fe657de593f4fd63af5c495e439b352d7edcae57be697b6f588d6895c21e9c20f1e72df9272b053f2095c64b5e26f26c7170ea
d05189ca10e3b2e4a7ad56a322205c181b9b85c9f444ff0f3d2d98cc175280f51c1bc7b0bedd98bc2d942ce6ab0822083e4181954c56212b297e0989c8204e8610
e04aca5c33f4e5f88568db3d7a89c92fb8edf061003a3feb694281ec6f93456700dcee72018145df7db4f7bfc1bb0ee36a7b16d5c6a338d1074ea0d71eae609a82
f0f9f409300a65c1fda207ddbd0a0c317ec941cef2ebc3971a320e4d40c7ba469252cc194b57240fa625e05efa7459199153fb39995c76b9fd6b7dead241d2af51
S-Box 2
 0123456789abcdef
0012a52d1c5b7a25ffa884d8cfc35402db8cb310c4ddd576a7eeb968a32259d5e08694783513ad5bd6ecfc105345b55f4c697be4684932493e8044b62f7f966210
107773b364d6ac84d524869fe2b456b86cd8813e21589ee888d9a96836442bdf7e58e58bd1d8ede1ca4dadf5119bac2db857d61a15f2f8014431d32fc848c1fd2d
201cc4668b8f447173bca4d773cec82bc39433741c7b3e7194c47e40f3fadd00309a3723d6120eb10a62ec8ba4bb1747738154adfa6c3b027038845bf08a4be0bc
3041e97ad45fd82134856168f758bbaf89cedf1aa5fd576da066a51bc629e83ad21eec25e6cd8c4011ff9c2663401c70cdf7d50623fd8752f88aad80fbd9ed9b71
40b24a4130873e45de63bd986c1d08ab87797fe98750d3da9cbe87744b404148cc951880194bd603aa6ac8d6257bf3649a01b3f847d5158244dff7dc7626a65150
509b1fc08df1fc0749e8d06e4552ef893c294e872098f7339d46bcb7981dd7c8a49d214279ab56979969d1e35281255d16b7e4f264c22cfbf2b4bec2b0ebf583e8
60a141801860a1a63dd7797c8a782eb31a9d514f9b160af7995acf58dd60aa22460014459b059660b32bda8703e8ce7a27a583761d2547f87ece7b51a70e074ba0
701d3dda6c950c9925c1a85293f03f00256bd03be383a42619fdb4c9cbf7c78cc4693c5c976168ada433b2da88673b54e1b9293665ec3ef6e74569aaf8f6dae37d
808ee10b0eb58b2e4b85c70a2e0b17b3b234675b3a10b8662abc6e24d1c4f99a0fd4effdf39c1a0343bf419ff27b51ea1906ab177f33e3298f4091aaaa72820212
9024380ec77572eb7993bf2d8deebc3694427575dd279ddef1143c4e0b6246d993558ce57189cf30d41dc86d2ba5549f74585c3eb49628651316b273d6ef360118
a0fdaff0e70bc24a47022bd739407e6c4fea2e9130e25a553910f4abc0864a641532dcf3e717e20721c744cabd25dc1aeda48e19277df4ec1a72e4987ab5c887e4
b0c91db0b2e8186cf4d0711a2244c63930b7264a17b9d14818e406e3a4db4d17e991e84c2c631e16b09750b2c85f0de1d75c2f9d9d3437457ad4a432adfa3b9b8f
c01ed19040cc4e3b3c825fa9eb70c7bd1aa918030bf6c7a581fec38ec6ea945e9145081d8413d5b7a243f3217d7c62e7dbe697f23c4ea419d6a4bd6f4d0686d738
d0ad9a278680b2b2f0e180a542161c2bd22f7a905ff598f51b8314ee3c4d0c99346980f74465184ed45da27172098de2e99ca54de51cfff68f9de21e543c3ea0d8
e09798071fdf1a992229afc100aee27c803312a5d03183f8ebb6d9a954340d51fd58b12b995f1d741c50c34fce8af66cf30df3ecc0ef1f8e06bde01981830e7cd2
f0da7640c4d01c1d803f80afc7a21ed0a1dceaa6dab3d98a83b1af890749873eba590f31eae2460c98724290fe1475ced222ce7d8ff946e4d4cafc9d03370f5644
S-Box 3
 0123456789abcdef
005b5170a1fe7b5d6958942f0e8866aaac6bd6ffa6c91b484182ea75a79bf709932fc6fea220aac2c18f795318b63717a19e5b836e8a87b7bf6ba1afd3171e40d9
104d907220fde1949adb4bb387a1a1d12884c62dbfd7d4364ff59a8c1cf22848eb8466744bed93687d61fdc88a803ba653834b3994df044006300c611e0cd9897b
20cfad65e2a437a709b0603e72568802d9cb5e5d0b791f973a3b3d0c639df53862d8cbda399daff8ea58266847a9000a09387f31cf07bf09a1b36ccfd1b1b249f0
3042c2ce1d0102b869233329d0d3815f3dd7d84757d38716664476f94525d78ddd69186472e6bad2ca47379c0551853b8f6f0014b5df043cdb3339c584a2780b6f
407cf5e480cd45c795aeefd4e5932ca88b06241dbbd2e6ec82aa6f0c0ae6cd58b9cd160940b4fd4d9588021ab66cd7879222f08f6be5a077558e931856dc319e0c
50bcdab434d7bc3a1409b74fc48a84ff93f7ab1f412ecb5c06b0064c78a941704118ba90a544880aaa4fc3630614779274fed41422a3a3160e6bcb5592281d40d6
60cc9a46297803312c2558d5ce30db13b7fd5a54bf239f2a0be048d8c4a9ead42547b0c90350a1b98c67c15f9d4ba7a43f871c0fbbbe53080e958715d136718bae
7074b7c7ba7c21460a452a6abf71b955b51584d7ddc5d7b3701698107dda6605f8b90ef1f139fdbf18b6c2566572f932af5976997690698513ef255500d83ec494
801ba574a3ee17533ccc001c0c7064a7e20a345e3fdcb9560f4eeb6efc99c6691d1bc878bdd8bafdc7d528a57b030c89faa05ef005512ca097e934937046020c17
90d15c12d8da7738bc47950b1cb50f8fd83a44caa9e7de73dbeaa58b32b8de2e1b18778516593cd5307538078d5daaa7bd5955cfaf92fd2c587fdc00b22ad80e87
a08dc1b490082bc577cc358bca73659d8509a9beb8ede23c19fb53c77c629a54826bc09b194db94594133bdb92ef914a033fce3c291b8443ef930131c9dcba8265
b0b7faef2d349de4789c64e10daf8b437539c5dcee8f01af1af650fbe7b9e423df61eee38d6ea3b6f33e2a0800f93e5f4aa4a4f365d3b0244efb5ef787e797fc6c
c03c11e456a8cc069b1386adc4051f6431f3638616637da5ef376fe1fde10d0b64e4b7d44a47d3379aba8f3343181c32c10d11f3e7bd1a773087899f72c2ff913a
d0565d920b844bc84b6a89b6b2a2b64e120724e3955e2ebf1195705a3b5807297f70d2466ed8db6b5a400a16bd22f7172c388b8248728ffc68a950e3a05426457c
e0075525fdfab1c24ce19e64fc2bfdc731b0dde1954faa80691780764dc08ef0a5d69cc34109cec67466b7604e10b30dcfee39cbb85f3f0bad2f85896974a021a1
f00853e86b28b6ce10b1e3d73192ced8ddda20723d19ae0c660d9b38dbf714fdbddade449a406695d95b2f6b5fa61bfbda6beccea75c5268e1462ceaea35aa3998
S-Box 4
 0123456789abcdef
00a3c644b4b5a0d38baa0adbfdf7b04356eca52ec1f1e441b9b012d4356a971fc564555c63693f8d24ed68f6e163a14362d458884494b2ca827e69b0ca6f8f74e4
10278a2f80ded65424b998a8c866f87cc72baa8e22a9b7bc19a698d2f4ace6686e03546161da208e3536846c420401feec9fdf44c1426b3aae79e4378a2b5055ed
20f15aefd4d0ded026dd5d8e75a50cd553f8bfab221e83761a9ca888b3a263d6fc969ae3364b04e1396a5a5132e2caef8b7782579897ca5722ebd90a9feb8ea1a0
30b770ecf656f63550711df826a48b182d2bafcd7401e2696674a862bef7e2240e776e2c0d77230d5c541c2304e33d8530d4621f346af84f83041857adbf63fc37
40718372aa10a261a603cea438dde1ff937850dcef5f78f3681bc505d037f975ae77a6f2f460d7ad9a3557e0f0462315041ee46768030817c3a2f2a660651d0313
5046e04d503324991044b20f815039e28a566dcee3249a90e57e1ae12dabcf3010e0fa59d66eff54a74286c102585a35bcbfc85b841e38eb9ed8ba38f0b3ed81e8
60bfad0cc17b53be2cb97a698cf7f07b0bee29c1b5fd22df2808e26f00a3a59e94ccb193ee598b07091c0f6a2a8b8505cac4349fcd07320ebcc5c8bcbe0801bec2
7006b14c587971c45876dd3664e95afb74d6df0d7837de6dceed75d50b7e55d4b1b97d0077fb98b2191ad49b0641bfbfba75a1bd9591f2dd9c8d96d9ffb79ca196
80134de08130000100de10076ada66dd229c86012adb657a4e55eda87f688f4b91694350d337909ebad4c3a6a8e8769762f55067e22b82509da9c8e589d6ef3573
9048f94f37632d05169ad37f62c6644992b3230230b5d2428cb3bd5d3093d2443cc7154f32626887a4695c2f29bcbc1c71507afce301385656bcdf0f86fd6530aa
a0a207ee078888e5fa6bb3bfd8817946ecbc18a3eee459227ad52d1ef7251ee3552ffb3faf323aa5de2b7adadd60c21f3d75b5d5196854b58b3b003c4cc2e59a47
b0c6844a041ce03228bb52d2cf7a7663d243003d9941ef977e22a083ff9628df77318a401182e8ca18a67150259ca0587398f21d05e9bf15606e4fbdd9f9a0de78
c01096374e7ce9206cef836d202f5721a4afc8933d168a6079552495876f5db24779cb04eb6fcab97944783948b4e8a5ed189364b25cd7d94ee168b43101f6b111
d0c6bf951c6cfae730900d36575a5e57aa929c36a646934158e633d4e94bf0c01a102affd0849f14c83e0d47186bbe76c5823b4912a31703defa9ed824dd5fb43a
e0e267d746606cd00f877045863c90e9cf1a96cb8242e5fecf2c1df5e9443ed6dbe37cebb25ba0d89d4bfd86bd9e2b205ffee50b60dd72f762c56a6ad7d92a5c79
f0862d72aa66755cedf6a91396cd8def43271fbfe7054073950250cdfb3bfae8e9509d9d2634baa109eb37f97bebc2a00fa613e8106ad052a0213563a2fd05358e

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

Thus, "I love Sue." encodes to 0x69792f41cf50b1bce5e162589cc68432

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

Melding those two strings together, she is able to decode his message to "I love Sue.", and she propmtly goes and thumps him on the head for being so forward with his affections!