class Crypto::Blowfish

Defined in:

crypto/blowfish.cr

Constant Summary

DEFAULT_ROUNDS = 16
P = UInt32.static_array(608135816, 2242054355_i64, 320440878, 57701188, 2752067618_i64, 698298832, 137296536, 3964562569_i64, 1160258022, 953160567, 3193202383_i64, 887688300, 3232508343_i64, 3380367581_i64, 1065670069, 3041331479_i64, 2450970073_i64, 2306472731_i64)
S = UInt32.static_array(3509652390_i64, 2564797868_i64, 805139163, 3491422135_i64, 3101798381_i64, 1780907670, 3128725573_i64, 4046225305_i64, 614570311, 3012652279_i64, 134345442, 2240740374_i64, 1667834072, 1901547113, 2757295779_i64, 4103290238_i64, 227898511, 1921955416, 1904987480, 2182433518_i64, 2069144605, 3260701109_i64, 2620446009_i64, 720527379, 3318853667_i64, 677414384, 3393288472_i64, 3101374703_i64, 2390351024_i64, 1614419982, 1822297739, 2954791486_i64, 3608508353_i64, 3174124327_i64, 2024746970, 1432378464, 3864339955_i64, 2857741204_i64, 1464375394, 1676153920, 1439316330, 715854006, 3033291828_i64, 289532110, 2706671279_i64, 2087905683, 3018724369_i64, 1668267050, 732546397, 1947742710, 3462151702_i64, 2609353502_i64, 2950085171_i64, 1814351708, 2050118529, 680887927, 999245976, 1800124847, 3300911131_i64, 1713906067, 1641548236, 4213287313_i64, 1216130144, 1575780402, 4018429277_i64, 3917837745_i64, 3693486850_i64, 3949271944_i64, 596196993, 3549867205_i64, 258830323, 2213823033_i64, 772490370, 2760122372_i64, 1774776394, 2652871518_i64, 566650946, 4142492826_i64, 1728879713, 2882767088_i64, 1783734482, 3629395816_i64, 2517608232_i64, 2874225571_i64, 1861159788, 326777828, 3124490320_i64, 2130389656, 2716951837_i64, 967770486, 1724537150, 2185432712_i64, 2364442137_i64, 1164943284, 2105845187, 998989502, 3765401048_i64, 2244026483_i64, 1075463327, 1455516326, 1322494562, 910128902, 469688178, 1117454909, 936433444, 3490320968_i64, 3675253459_i64, 1240580251, 122909385, 2157517691_i64, 634681816, 4142456567_i64, 3825094682_i64, 3061402683_i64, 2540495037_i64, 79693498, 3249098678_i64, 1084186820, 1583128258, 426386531, 1761308591, 1047286709, 322548459, 995290223, 1845252383, 2603652396_i64, 3431023940_i64, 2942221577_i64, 3202600964_i64, 3727903485_i64, 1712269319, 422464435, 3234572375_i64, 1170764815, 3523960633_i64, 3117677531_i64, 1434042557, 442511882, 3600875718_i64, 1076654713, 1738483198, 4213154764_i64, 2393238008_i64, 3677496056_i64, 1014306527, 4251020053_i64, 793779912, 2902807211_i64, 842905082, 4246964064_i64, 1395751752, 1040244610, 2656851899_i64, 3396308128_i64, 445077038, 3742853595_i64, 3577915638_i64, 679411651, 2892444358_i64, 2354009459_i64, 1767581616, 3150600392_i64, 3791627101_i64, 3102740896_i64, 284835224, 4246832056_i64, 1258075500, 768725851, 2589189241_i64, 3069724005_i64, 3532540348_i64, 1274779536, 3789419226_i64, 2764799539_i64, 1660621633, 3471099624_i64, 4011903706_i64, 913787905, 3497959166_i64, 737222580, 2514213453_i64, 2928710040_i64, 3937242737_i64, 1804850592, 3499020752_i64, 2949064160_i64, 2386320175_i64, 2390070455_i64, 2415321851_i64, 4061277028_i64, 2290661394_i64, 2416832540_i64, 1336762016, 1754252060, 3520065937_i64, 3014181293_i64, 791618072, 3188594551_i64, 3933548030_i64, 2332172193_i64, 3852520463_i64, 3043980520_i64, 413987798, 3465142937_i64, 3030929376_i64, 4245938359_i64, 2093235073, 3534596313_i64, 375366246, 2157278981_i64, 2479649556_i64, 555357303, 3870105701_i64, 2008414854, 3344188149_i64, 4221384143_i64, 3956125452_i64, 2067696032, 3594591187_i64, 2921233993_i64, 2428461, 544322398, 577241275, 1471733935, 610547355, 4027169054_i64, 1432588573, 1507829418, 2025931657, 3646575487_i64, 545086370, 48609733, 2200306550_i64, 1653985193, 298326376, 1316178497, 3007786442_i64, 2064951626, 458293330, 2589141269_i64, 3591329599_i64, 3164325604_i64, 727753846, 2179363840_i64, 146436021, 1461446943, 4069977195_i64, 705550613, 3059967265_i64, 3887724982_i64, 4281599278_i64, 3313849956_i64, 1404054877, 2845806497_i64, 146425753, 1854211946, 1266315497, 3048417604_i64, 3681880366_i64, 3289982499_i64, 2909710000_i64, 1235738493, 2632868024_i64, 2414719590_i64, 3970600049_i64, 1771706367, 1449415276, 3266420449_i64, 422970021, 1963543593, 2690192192_i64, 3826793022_i64, 1062508698, 1531092325, 1804592342, 2583117782_i64, 2714934279_i64, 4024971509_i64, 1294809318, 4028980673_i64, 1289560198, 2221992742_i64, 1669523910, 35572830, 157838143, 1052438473, 1016535060, 1802137761, 1753167236, 1386275462, 3080475397_i64, 2857371447_i64, 1040679964, 2145300060, 2390574316_i64, 1461121720, 2956646967_i64, 4031777805_i64, 4028374788_i64, 33600511, 2920084762_i64, 1018524850, 629373528, 3691585981_i64, 3515945977_i64, 2091462646, 2486323059_i64, 586499841, 988145025, 935516892, 3367335476_i64, 2599673255_i64, 2839830854_i64, 265290510, 3972581182_i64, 2759138881_i64, 3795373465_i64, 1005194799, 847297441, 406762289, 1314163512, 1332590856, 1866599683, 4127851711_i64, 750260880, 613907577, 1450815602, 3165620655_i64, 3734664991_i64, 3650291728_i64, 3012275730_i64, 3704569646_i64, 1427272223, 778793252, 1343938022, 2676280711_i64, 2052605720, 1946737175, 3164576444_i64, 3914038668_i64, 3967478842_i64, 3682934266_i64, 1661551462, 3294938066_i64, 4011595847_i64, 840292616, 3712170807_i64, 616741398, 312560963, 711312465, 1351876610, 322626781, 1910503582, 271666773, 2175563734_i64, 1594956187, 70604529, 3617834859_i64, 1007753275, 1495573769, 4069517037_i64, 2549218298_i64, 2663038764_i64, 504708206, 2263041392_i64, 3941167025_i64, 2249088522_i64, 1514023603, 1998579484, 1312622330, 694541497, 2582060303_i64, 2151582166_i64, 1382467621, 776784248, 2618340202_i64, 3323268794_i64, 2497899128_i64, 2784771155_i64, 503983604, 4076293799_i64, 907881277, 423175695, 432175456, 1378068232, 4145222326_i64, 3954048622_i64, 3938656102_i64, 3820766613_i64, 2793130115_i64, 2977904593_i64, 26017576, 3274890735_i64, 3194772133_i64, 1700274565, 1756076034, 4006520079_i64, 3677328699_i64, 720338349, 1533947780, 354530856, 688349552, 3973924725_i64, 1637815568, 332179504, 3949051286_i64, 53804574, 2852348879_i64, 3044236432_i64, 1282449977, 3583942155_i64, 3416972820_i64, 4006381244_i64, 1617046695, 2628476075_i64, 3002303598_i64, 1686838959, 431878346, 2686675385_i64, 1700445008, 1080580658, 1009431731, 832498133, 3223435511_i64, 2605976345_i64, 2271191193_i64, 2516031870_i64, 1648197032, 4164389018_i64, 2548247927_i64, 300782431, 375919233, 238389289, 3353747414_i64, 2531188641_i64, 2019080857, 1475708069, 455242339, 2609103871_i64, 448939670, 3451063019_i64, 1395535956, 2413381860_i64, 1841049896, 1491858159, 885456874, 4264095073_i64, 4001119347_i64, 1565136089, 3898914787_i64, 1108368660, 540939232, 1173283510, 2745871338_i64, 3681308437_i64, 4207628240_i64, 3343053890_i64, 4016749493_i64, 1699691293, 1103962373, 3625875870_i64, 2256883143_i64, 3830138730_i64, 1031889488, 3479347698_i64, 1535977030, 4236805024_i64, 3251091107_i64, 2132092099, 1774941330, 1199868427, 1452454533, 157007616, 2904115357_i64, 342012276, 595725824, 1480756522, 206960106, 497939518, 591360097, 863170706, 2375253569_i64, 3596610801_i64, 1814182875, 2094937945, 3421402208_i64, 1082520231, 3463918190_i64, 2785509508_i64, 435703966, 3908032597_i64, 1641649973, 2842273706_i64, 3305899714_i64, 1510255612, 2148256476_i64, 2655287854_i64, 3276092548_i64, 4258621189_i64, 236887753, 3681803219_i64, 274041037, 1734335097, 3815195456_i64, 3317970021_i64, 1899903192, 1026095262, 4050517792_i64, 356393447, 2410691914_i64, 3873677099_i64, 3682840055_i64, 3913112168_i64, 2491498743_i64, 4132185628_i64, 2489919796_i64, 1091903735, 1979897079, 3170134830_i64, 3567386728_i64, 3557303409_i64, 857797738, 1136121015, 1342202287, 507115054, 2535736646_i64, 337727348, 3213592640_i64, 1301675037, 2528481711_i64, 1895095763, 1721773893, 3216771564_i64, 62756741, 2142006736, 835421444, 2531993523_i64, 1442658625, 3659876326_i64, 2882144922_i64, 676362277, 1392781812, 170690266, 3921047035_i64, 1759253602, 3611846912_i64, 1745797284, 664899054, 1329594018, 3901205900_i64, 3045908486_i64, 2062866102, 2865634940_i64, 3543621612_i64, 3464012697_i64, 1080764994, 553557557, 3656615353_i64, 3996768171_i64, 991055499, 499776247, 1265440854, 648242737, 3940784050_i64, 980351604, 3713745714_i64, 1749149687, 3396870395_i64, 4211799374_i64, 3640570775_i64, 1161844396, 3125318951_i64, 1431517754, 545492359, 4268468663_i64, 3499529547_i64, 1437099964, 2702547544_i64, 3433638243_i64, 2581715763_i64, 2787789398_i64, 1060185593, 1593081372, 2418618748_i64, 4260947970_i64, 69676912, 2159744348_i64, 86519011, 2512459080_i64, 3838209314_i64, 1220612927, 3339683548_i64, 133810670, 1090789135, 1078426020, 1569222167, 845107691, 3583754449_i64, 4072456591_i64, 1091646820, 628848692, 1613405280, 3757631651_i64, 526609435, 236106946, 48312990, 2942717905_i64, 3402727701_i64, 1797494240, 859738849, 992217954, 4005476642_i64, 2243076622_i64, 3870952857_i64, 3732016268_i64, 765654824, 3490871365_i64, 2511836413_i64, 1685915746, 3888969200_i64, 1414112111, 2273134842_i64, 3281911079_i64, 4080962846_i64, 172450625, 2569994100_i64, 980381355, 4109958455_i64, 2819808352_i64, 2716589560_i64, 2568741196_i64, 3681446669_i64, 3329971472_i64, 1835478071, 660984891, 3704678404_i64, 4045999559_i64, 3422617507_i64, 3040415634_i64, 1762651403, 1719377915, 3470491036_i64, 2693910283_i64, 3642056355_i64, 3138596744_i64, 1364962596, 2073328063, 1983633131, 926494387, 3423689081_i64, 2150032023_i64, 4096667949_i64, 1749200295, 3328846651_i64, 309677260, 2016342300, 1779581495, 3079819751_i64, 111262694, 1274766160, 443224088, 298511866, 1025883608, 3806446537_i64, 1145181785, 168956806, 3641502830_i64, 3584813610_i64, 1689216846, 3666258015_i64, 3200248200_i64, 1692713982, 2646376535_i64, 4042768518_i64, 1618508792, 1610833997, 3523052358_i64, 4130873264_i64, 2001055236, 3610705100_i64, 2202168115_i64, 4028541809_i64, 2961195399_i64, 1006657119, 2006996926, 3186142756_i64, 1430667929, 3210227297_i64, 1314452623, 4074634658_i64, 4101304120_i64, 2273951170_i64, 1399257539, 3367210612_i64, 3027628629_i64, 1190975929, 2062231137, 2333990788_i64, 2221543033_i64, 2438960610_i64, 1181637006, 548689776, 2362791313_i64, 3372408396_i64, 3104550113_i64, 3145860560_i64, 296247880, 1970579870, 3078560182_i64, 3769228297_i64, 1714227617, 3291629107_i64, 3898220290_i64, 166772364, 1251581989, 493813264, 448347421, 195405023, 2709975567_i64, 677966185, 3703036547_i64, 1463355134, 2715995803_i64, 1338867538, 1343315457, 2802222074_i64, 2684532164_i64, 233230375, 2599980071_i64, 2000651841, 3277868038_i64, 1638401717, 4028070440_i64, 3237316320_i64, 6314154, 819756386, 300326615, 590932579, 1405279636, 3267499572_i64, 3150704214_i64, 2428286686_i64, 3959192993_i64, 3461946742_i64, 1862657033, 1266418056, 963775037, 2089974820, 2263052895_i64, 1917689273, 448879540, 3550394620_i64, 3981727096_i64, 150775221, 3627908307_i64, 1303187396, 508620638, 2975983352_i64, 2726630617_i64, 1817252668, 1876281319, 1457606340, 908771278, 3720792119_i64, 3617206836_i64, 2455994898_i64, 1729034894, 1080033504, 976866871, 3556439503_i64, 2881648439_i64, 1522871579, 1555064734, 1336096578, 3548522304_i64, 2579274686_i64, 3574697629_i64, 3205460757_i64, 3593280638_i64, 3338716283_i64, 3079412587_i64, 564236357, 2993598910_i64, 1781952180, 1464380207, 3163844217_i64, 3332601554_i64, 1699332808, 1393555694, 1183702653, 3581086237_i64, 1288719814, 691649499, 2847557200_i64, 2895455976_i64, 3193889540_i64, 2717570544_i64, 1781354906, 1676643554, 2592534050_i64, 3230253752_i64, 1126444790, 2770207658_i64, 2633158820_i64, 2210423226_i64, 2615765581_i64, 2414155088_i64, 3127139286_i64, 673620729, 2805611233_i64, 1269405062, 4015350505_i64, 3341807571_i64, 4149409754_i64, 1057255273, 2012875353, 2162469141_i64, 2276492801_i64, 2601117357_i64, 993977747, 3918593370_i64, 2654263191_i64, 753973209, 36408145, 2530585658_i64, 25011837, 3520020182_i64, 2088578344, 530523599, 2918365339_i64, 1524020338, 1518925132, 3760827505_i64, 3759777254_i64, 1202760957, 3985898139_i64, 3906192525_i64, 674977740, 4174734889_i64, 2031300136, 2019492241, 3983892565_i64, 4153806404_i64, 3822280332_i64, 352677332, 2297720250_i64, 60907813, 90501309, 3286998549_i64, 1016092578, 2535922412_i64, 2839152426_i64, 457141659, 509813237, 4120667899_i64, 652014361, 1966332200, 2975202805_i64, 55981186, 2327461051_i64, 676427537, 3255491064_i64, 2882294119_i64, 3433927263_i64, 1307055953, 942726286, 933058658, 2468411793_i64, 3933900994_i64, 4215176142_i64, 1361170020, 2001714738, 2830558078_i64, 3274259782_i64, 1222529897, 1679025792, 2729314320_i64, 3714953764_i64, 1770335741, 151462246, 3013232138_i64, 1682292957, 1483529935, 471910574, 1539241949, 458788160, 3436315007_i64, 1807016891, 3718408830_i64, 978976581, 1043663428, 3165965781_i64, 1927990952, 4200891579_i64, 2372276910_i64, 3208408903_i64, 3533431907_i64, 1412390302, 2931980059_i64, 4132332400_i64, 1947078029, 3881505623_i64, 4168226417_i64, 2941484381_i64, 1077988104, 1320477388, 886195818, 18198404, 3786409000_i64, 2509781533_i64, 112762804, 3463356488_i64, 1866414978, 891333506, 18488651, 661792760, 1628790961, 3885187036_i64, 3141171499_i64, 876946877, 2693282273_i64, 1372485963, 791857591, 2686433993_i64, 3759982718_i64, 3167212022_i64, 3472953795_i64, 2716379847_i64, 445679433, 3561995674_i64, 3504004811_i64, 3574258232_i64, 54117162, 3331405415_i64, 2381918588_i64, 3769707343_i64, 4154350007_i64, 1140177722, 4074052095_i64, 668550556, 3214352940_i64, 367459370, 261225585, 2610173221_i64, 4209349473_i64, 3468074219_i64, 3265815641_i64, 314222801, 3066103646_i64, 3808782860_i64, 282218597, 3406013506_i64, 3773591054_i64, 379116347, 1285071038, 846784868, 2669647154_i64, 3771962079_i64, 3550491691_i64, 2305946142_i64, 453669953, 1268987020, 3317592352_i64, 3279303384_i64, 3744833421_i64, 2610507566_i64, 3859509063_i64, 266596637, 3847019092_i64, 517658769, 3462560207_i64, 3443424879_i64, 370717030, 4247526661_i64, 2224018117_i64, 4143653529_i64, 4112773975_i64, 2788324899_i64, 2477274417_i64, 1456262402, 2901442914_i64, 1517677493, 1846949527, 2295493580_i64, 3734397586_i64, 2176403920_i64, 1280348187, 1908823572, 3871786941_i64, 846861322, 1172426758, 3287448474_i64, 3383383037_i64, 1655181056, 3139813346_i64, 901632758, 1897031941, 2986607138_i64, 3066810236_i64, 3447102507_i64, 1393639104, 373351379, 950779232, 625454576, 3124240540_i64, 4148612726_i64, 2007998917, 544563296, 2244738638_i64, 2330496472_i64, 2058025392, 1291430526, 424198748, 50039436, 29584100, 3605783033_i64, 2429876329_i64, 2791104160_i64, 1057563949, 3255363231_i64, 3075367218_i64, 3463963227_i64, 1469046755, 985887462)

Constructors

Instance Method Summary

Instance methods inherited from class Reference

==(other : self)
==(other : JSON::Any)
==(other : YAML::Any)
==(other)
==
, dup dup, hash(hasher) hash, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference)
same?(other : Nil)
same?
, to_s(io : IO) : Nil to_s

Constructor methods inherited from class Reference

new new

Instance methods inherited from class Object

!=(other) !=, !~(other) !~, ==(other) ==, ===(other : JSON::Any)
===(other : YAML::Any)
===(other)
===
, =~(other) =~, class class, dup dup, hash(hasher)
hash
hash
, inspect(io : IO)
inspect
inspect
, itself itself, not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, tap(&block) tap, to_json(io : IO)
to_json
to_json
, to_pretty_json(indent : String = " ")
to_pretty_json(io : IO, indent : String = " ")
to_pretty_json
, to_s
to_s(io : IO)
to_s
, to_yaml(io : IO)
to_yaml
to_yaml
, try(&block) try, unsafe_as(type : T.class) forall T unsafe_as

Constructor methods inherited from class Object

from_json(string_or_io, root : String) : self
from_json(string_or_io) : self
from_json
, from_yaml(string_or_io : String | IO) : self from_yaml

Constructor Detail

def self.new(rounds = DEFAULT_ROUNDS) #

[View source]

Instance Method Detail

def decrypt_pair(l : UInt32, r : UInt32) #

[View source]
def encrypt_pair(l : UInt32, r : UInt32) #

[View source]
def expand_key(key) #

[View source]