digitalmars.D.announce - blowfish
- r (864/864) Mar 23 2006 i use and it seems to work, not very well tested so. i hope i interprete...
- Dejan Lekic (1/1) Mar 23 2006 Can You _ATTACH_ file next time?
- r (266/266) Mar 23 2006 sorry i tried to attach, but it did not work. little over 19k encryped o...
- r (2/2) Mar 23 2006 sorry forgot the link http://www.cryptosys.net/pki/
- r (2/2) Mar 23 2006 sorry forgot the link http://www.cryptosys.net/pki/ for cryptolib
- Regan Heath (7/7) Mar 23 2006 You might be interested in some existing crypto work I've done:
- Brad Anderson (12/21) Mar 23 2006 Woo Hoo! Definitely send the crypto stuff to Ares if Sean will have it....
- Derek Parnell (10/34) Mar 23 2006 Need to cater for non-text data too.
- Sean Kelly (14/36) Mar 23 2006 I think it would be useful to have both standalone functions and filters...
- Sean Kelly (4/11) Mar 23 2006 That's a bit past the level of what I've been focusing on, but it's
- kris (5/21) Mar 23 2006 I've seriously considered adding a crypto package to Mango; particularly...
- Sean Kelly (5/24) Mar 23 2006 Definately. As I mentioned in my other post, I'd like to have a crypto
- Regan Heath (35/52) Mar 23 2006 (this is essentially a reply to everyone on this thread)
- kris (5/83) Mar 23 2006 That all sounds great (though I'll admit to being more than a bit leery
- Regan Heath (18/21) Mar 27 2006 I just went ahead and converted my hashing code from the struct+mixin
- kris (3/30) Mar 27 2006 Nice! It's now got a home in mango.crypto.*
- Kyle Furlong (2/25) Mar 23 2006 As I foresee the eventual oneness of Ares + Mango, sure.
i use and it seems to work, not very well tested so. i hope i interpreted the license correctly. r /* The Bouncy Castle License Copyright (c) 2000-2004 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import std.stdio; import std.string; /** * A class that provides Blowfish key encryption operations, * such as encoding data and generating keys. * All the algorithms herein are from Applied Cryptography * and implement a simplified cryptography interface. */ public class BlowfishEngine { private const int[] KP = [ cast(int) 0x243F6A88, cast(int) 0x85A308D3, cast(int) 0x13198A2E, cast(int) 0x03707344, cast(int) 0xA4093822, cast(int) 0x299F31D0, cast(int) 0x082EFA98, cast(int) 0xEC4E6C89, cast(int) 0x452821E6, cast(int) 0x38D01377, cast(int) 0xBE5466CF, cast(int) 0x34E90C6C, cast(int) 0xC0AC29B7, cast(int) 0xC97C50DD, cast(int) 0x3F84D5B5, cast(int) 0xB5470917, cast(int) 0x9216D5D9, cast(int) 0x8979FB1B ]; private const int[] KS0 = [ cast(int) 0xD1310BA6, cast(int) 0x98DFB5AC, cast(int) 0x2FFD72DB, cast(int) 0xD01ADFB7, cast(int) 0xB8E1AFED, cast(int) 0x6A267E96, cast(int) 0xBA7C9045, cast(int) 0xF12C7F99, cast(int) 0x24A19947, cast(int) 0xB3916CF7, cast(int) 0x0801F2E2, cast(int) 0x858EFC16, cast(int) 0x636920D8, cast(int) 0x71574E69, cast(int) 0xA458FEA3, cast(int) 0xF4933D7E, cast(int) 0x0D95748F, cast(int) 0x728EB658, cast(int) 0x718BCD58, cast(int) 0x82154AEE, cast(int) 0x7B54A41D, cast(int) 0xC25A59B5, cast(int) 0x9C30D539, cast(int) 0x2AF26013, cast(int) 0xC5D1B023, cast(int) 0x286085F0, cast(int) 0xCA417918, cast(int) 0xB8DB38EF, cast(int) 0x8E79DCB0, cast(int) 0x603A180E, cast(int) 0x6C9E0E8B, cast(int) 0xB01E8A3E, cast(int) 0xD71577C1, cast(int) 0xBD314B27, cast(int) 0x78AF2FDA, cast(int) 0x55605C60, cast(int) 0xE65525F3, cast(int) 0xAA55AB94, cast(int) 0x57489862, cast(int) 0x63E81440, cast(int) 0x55CA396A, cast(int) 0x2AAB10B6, cast(int) 0xB4CC5C34, cast(int) 0x1141E8CE, cast(int) 0xA15486AF, cast(int) 0x7C72E993, cast(int) 0xB3EE1411, cast(int) 0x636FBC2A, cast(int) 0x2BA9C55D, cast(int) 0x741831F6, cast(int) 0xCE5C3E16, cast(int) 0x9B87931E, cast(int) 0xAFD6BA33, cast(int) 0x6C24CF5C, cast(int) 0x7A325381, cast(int) 0x28958677, cast(int) 0x3B8F4898, cast(int) 0x6B4BB9AF, cast(int) 0xC4BFE81B, cast(int) 0x66282193, cast(int) 0x61D809CC, cast(int) 0xFB21A991, cast(int) 0x487CAC60, cast(int) 0x5DEC8032, cast(int) 0xEF845D5D, cast(int) 0xE98575B1, cast(int) 0xDC262302, cast(int) 0xEB651B88, cast(int) 0x23893E81, cast(int) 0xD396ACC5, cast(int) 0x0F6D6FF3, cast(int) 0x83F44239, cast(int) 0x2E0B4482, cast(int) 0xA4842004, cast(int) 0x69C8F04A, cast(int) 0x9E1F9B5E, cast(int) 0x21C66842, cast(int) 0xF6E96C9A, cast(int) 0x670C9C61, cast(int) 0xABD388F0, cast(int) 0x6A51A0D2, cast(int) 0xD8542F68, cast(int) 0x960FA728, cast(int) 0xAB5133A3, cast(int) 0x6EEF0B6C, cast(int) 0x137A3BE4, cast(int) 0xBA3BF050, cast(int) 0x7EFB2A98, cast(int) 0xA1F1651D, cast(int) 0x39AF0176, cast(int) 0x66CA593E, cast(int) 0x82430E88, cast(int) 0x8CEE8619, cast(int) 0x456F9FB4, cast(int) 0x7D84A5C3, cast(int) 0x3B8B5EBE, cast(int) 0xE06F75D8, cast(int) 0x85C12073, cast(int) 0x401A449F, cast(int) 0x56C16AA6, cast(int) 0x4ED3AA62, cast(int) 0x363F7706, cast(int) 0x1BFEDF72, cast(int) 0x429B023D, cast(int) 0x37D0D724, cast(int) 0xD00A1248, cast(int) 0xDB0FEAD3, cast(int) 0x49F1C09B, cast(int) 0x075372C9, cast(int) 0x80991B7B, cast(int) 0x25D479D8, cast(int) 0xF6E8DEF7, cast(int) 0xE3FE501A, cast(int) 0xB6794C3B, cast(int) 0x976CE0BD, cast(int) 0x04C006BA, cast(int) 0xC1A94FB6, cast(int) 0x409F60C4, cast(int) 0x5E5C9EC2, cast(int) 0x196A2463, cast(int) 0x68FB6FAF, cast(int) 0x3E6C53B5, cast(int) 0x1339B2EB, cast(int) 0x3B52EC6F, cast(int) 0x6DFC511F, cast(int) 0x9B30952C, cast(int) 0xCC814544, cast(int) 0xAF5EBD09, cast(int) 0xBEE3D004, cast(int) 0xDE334AFD, cast(int) 0x660F2807, cast(int) 0x192E4BB3, cast(int) 0xC0CBA857, cast(int) 0x45C8740F, cast(int) 0xD20B5F39, cast(int) 0xB9D3FBDB, cast(int) 0x5579C0BD, cast(int) 0x1A60320A, cast(int) 0xD6A100C6, cast(int) 0x402C7279, cast(int) 0x679F25FE, cast(int) 0xFB1FA3CC, cast(int) 0x8EA5E9F8, cast(int) 0xDB3222F8, cast(int) 0x3C7516DF, cast(int) 0xFD616B15, cast(int) 0x2F501EC8, cast(int) 0xAD0552AB, cast(int) 0x323DB5FA, cast(int) 0xFD238760, cast(int) 0x53317B48, cast(int) 0x3E00DF82, cast(int) 0x9E5C57BB, cast(int) 0xCA6F8CA0, cast(int) 0x1A87562E, cast(int) 0xDF1769DB, cast(int) 0xD542A8F6, cast(int) 0x287EFFC3, cast(int) 0xAC6732C6, cast(int) 0x8C4F5573, cast(int) 0x695B27B0, cast(int) 0xBBCA58C8, cast(int) 0xE1FFA35D, cast(int) 0xB8F011A0, cast(int) 0x10FA3D98, cast(int) 0xFD2183B8, cast(int) 0x4AFCB56C, cast(int) 0x2DD1D35B, cast(int) 0x9A53E479, cast(int) 0xB6F84565, cast(int) 0xD28E49BC, cast(int) 0x4BFB9790, cast(int) 0xE1DDF2DA, cast(int) 0xA4CB7E33, cast(int) 0x62FB1341, cast(int) 0xCEE4C6E8, cast(int) 0xEF20CADA, cast(int) 0x36774C01, cast(int) 0xD07E9EFE, cast(int) 0x2BF11FB4, cast(int) 0x95DBDA4D, cast(int) 0xAE909198, cast(int) 0xEAAD8E71, cast(int) 0x6B93D5A0, cast(int) 0xD08ED1D0, cast(int) 0xAFC725E0, cast(int) 0x8E3C5B2F, cast(int) 0x8E7594B7, cast(int) 0x8FF6E2FB, cast(int) 0xF2122B64, cast(int) 0x8888B812, cast(int) 0x900DF01C, cast(int) 0x4FAD5EA0, cast(int) 0x688FC31C, cast(int) 0xD1CFF191, cast(int) 0xB3A8C1AD, cast(int) 0x2F2F2218, cast(int) 0xBE0E1777, cast(int) 0xEA752DFE, cast(int) 0x8B021FA1, cast(int) 0xE5A0CC0F, cast(int) 0xB56F74E8, cast(int) 0x18ACF3D6, cast(int) 0xCE89E299, cast(int) 0xB4A84FE0, cast(int) 0xFD13E0B7, cast(int) 0x7CC43B81, cast(int) 0xD2ADA8D9, cast(int) 0x165FA266, cast(int) 0x80957705, cast(int) 0x93CC7314, cast(int) 0x211A1477, cast(int) 0xE6AD2065, cast(int) 0x77B5FA86, cast(int) 0xC75442F5, cast(int) 0xFB9D35CF, cast(int) 0xEBCDAF0C, cast(int) 0x7B3E89A0, cast(int) 0xD6411BD3, cast(int) 0xAE1E7E49, cast(int) 0x00250E2D, cast(int) 0x2071B35E, cast(int) 0x226800BB, cast(int) 0x57B8E0AF, cast(int) 0x2464369B, cast(int) 0xF009B91E, cast(int) 0x5563911D, cast(int) 0x59DFA6AA, cast(int) 0x78C14389, cast(int) 0xD95A537F, cast(int) 0x207D5BA2, cast(int) 0x02E5B9C5, cast(int) 0x83260376, cast(int) 0x6295CFA9, cast(int) 0x11C81968, cast(int) 0x4E734A41, cast(int) 0xB3472DCA, cast(int) 0x7B14A94A, cast(int) 0x1B510052, cast(int) 0x9A532915, cast(int) 0xD60F573F, cast(int) 0xBC9BC6E4, cast(int) 0x2B60A476, cast(int) 0x81E67400, cast(int) 0x08BA6FB5, cast(int) 0x571BE91F, cast(int) 0xF296EC6B, cast(int) 0x2A0DD915, cast(int) 0xB6636521, cast(int) 0xE7B9F9B6, cast(int) 0xFF34052E, cast(int) 0xC5855664, cast(int) 0x53B02D5D, cast(int) 0xA99F8FA1, cast(int) 0x08BA4799, cast(int) 0x6E85076A ]; private const int[] KS1 = [ cast(int) 0x4B7A70E9, cast(int) 0xB5B32944, cast(int) 0xDB75092E, cast(int) 0xC4192623, cast(int) 0xAD6EA6B0, cast(int) 0x49A7DF7D, cast(int) 0x9CEE60B8, cast(int) 0x8FEDB266, cast(int) 0xECAA8C71, cast(int) 0x699A17FF, cast(int) 0x5664526C, cast(int) 0xC2B19EE1, cast(int) 0x193602A5, cast(int) 0x75094C29, cast(int) 0xA0591340, cast(int) 0xE4183A3E, cast(int) 0x3F54989A, cast(int) 0x5B429D65, cast(int) 0x6B8FE4D6, cast(int) 0x99F73FD6, cast(int) 0xA1D29C07, cast(int) 0xEFE830F5, cast(int) 0x4D2D38E6, cast(int) 0xF0255DC1, cast(int) 0x4CDD2086, cast(int) 0x8470EB26, cast(int) 0x6382E9C6, cast(int) 0x021ECC5E, cast(int) 0x09686B3F, cast(int) 0x3EBAEFC9, cast(int) 0x3C971814, cast(int) 0x6B6A70A1, cast(int) 0x687F3584, cast(int) 0x52A0E286, cast(int) 0xB79C5305, cast(int) 0xAA500737, cast(int) 0x3E07841C, cast(int) 0x7FDEAE5C, cast(int) 0x8E7D44EC, cast(int) 0x5716F2B8, cast(int) 0xB03ADA37, cast(int) 0xF0500C0D, cast(int) 0xF01C1F04, cast(int) 0x0200B3FF, cast(int) 0xAE0CF51A, cast(int) 0x3CB574B2, cast(int) 0x25837A58, cast(int) 0xDC0921BD, cast(int) 0xD19113F9, cast(int) 0x7CA92FF6, cast(int) 0x94324773, cast(int) 0x22F54701, cast(int) 0x3AE5E581, cast(int) 0x37C2DADC, cast(int) 0xC8B57634, cast(int) 0x9AF3DDA7, cast(int) 0xA9446146, cast(int) 0x0FD0030E, cast(int) 0xECC8C73E, cast(int) 0xA4751E41, cast(int) 0xE238CD99, cast(int) 0x3BEA0E2F, cast(int) 0x3280BBA1, cast(int) 0x183EB331, cast(int) 0x4E548B38, cast(int) 0x4F6DB908, cast(int) 0x6F420D03, cast(int) 0xF60A04BF, cast(int) 0x2CB81290, cast(int) 0x24977C79, cast(int) 0x5679B072, cast(int) 0xBCAF89AF, cast(int) 0xDE9A771F, cast(int) 0xD9930810, cast(int) 0xB38BAE12, cast(int) 0xDCCF3F2E, cast(int) 0x5512721F, cast(int) 0x2E6B7124, cast(int) 0x501ADDE6, cast(int) 0x9F84CD87, cast(int) 0x7A584718, cast(int) 0x7408DA17, cast(int) 0xBC9F9ABC, cast(int) 0xE94B7D8C, cast(int) 0xEC7AEC3A, cast(int) 0xDB851DFA, cast(int) 0x63094366, cast(int) 0xC464C3D2, cast(int) 0xEF1C1847, cast(int) 0x3215D908, cast(int) 0xDD433B37, cast(int) 0x24C2BA16, cast(int) 0x12A14D43, cast(int) 0x2A65C451, cast(int) 0x50940002, cast(int) 0x133AE4DD, cast(int) 0x71DFF89E, cast(int) 0x10314E55, cast(int) 0x81AC77D6, cast(int) 0x5F11199B, cast(int) 0x043556F1, cast(int) 0xD7A3C76B, cast(int) 0x3C11183B, cast(int) 0x5924A509, cast(int) 0xF28FE6ED, cast(int) 0x97F1FBFA, cast(int) 0x9EBABF2C, cast(int) 0x1E153C6E, cast(int) 0x86E34570, cast(int) 0xEAE96FB1, cast(int) 0x860E5E0A, cast(int) 0x5A3E2AB3, cast(int) 0x771FE71C, cast(int) 0x4E3D06FA, cast(int) 0x2965DCB9, cast(int) 0x99E71D0F, cast(int) 0x803E89D6, cast(int) 0x5266C825, cast(int) 0x2E4CC978, cast(int) 0x9C10B36A, cast(int) 0xC6150EBA, cast(int) 0x94E2EA78, cast(int) 0xA5FC3C53, cast(int) 0x1E0A2DF4, cast(int) 0xF2F74EA7, cast(int) 0x361D2B3D, cast(int) 0x1939260F, cast(int) 0x19C27960, cast(int) 0x5223A708, cast(int) 0xF71312B6, cast(int) 0xEBADFE6E, cast(int) 0xEAC31F66, cast(int) 0xE3BC4595, cast(int) 0xA67BC883, cast(int) 0xB17F37D1, cast(int) 0x018CFF28, cast(int) 0xC332DDEF, cast(int) 0xBE6C5AA5, cast(int) 0x65582185, cast(int) 0x68AB9802, cast(int) 0xEECEA50F, cast(int) 0xDB2F953B, cast(int) 0x2AEF7DAD, cast(int) 0x5B6E2F84, cast(int) 0x1521B628, cast(int) 0x29076170, cast(int) 0xECDD4775, cast(int) 0x619F1510, cast(int) 0x13CCA830, cast(int) 0xEB61BD96, cast(int) 0x0334FE1E, cast(int) 0xAA0363CF, cast(int) 0xB5735C90, cast(int) 0x4C70A239, cast(int) 0xD59E9E0B, cast(int) 0xCBAADE14, cast(int) 0xEECC86BC, cast(int) 0x60622CA7, cast(int) 0x9CAB5CAB, cast(int) 0xB2F3846E, cast(int) 0x648B1EAF, cast(int) 0x19BDF0CA, cast(int) 0xA02369B9, cast(int) 0x655ABB50, cast(int) 0x40685A32, cast(int) 0x3C2AB4B3, cast(int) 0x319EE9D5, cast(int) 0xC021B8F7, cast(int) 0x9B540B19, cast(int) 0x875FA099, cast(int) 0x95F7997E, cast(int) 0x623D7DA8, cast(int) 0xF837889A, cast(int) 0x97E32D77, cast(int) 0x11ED935F, cast(int) 0x16681281, cast(int) 0x0E358829, cast(int) 0xC7E61FD6, cast(int) 0x96DEDFA1, cast(int) 0x7858BA99, cast(int) 0x57F584A5, cast(int) 0x1B227263, cast(int) 0x9B83C3FF, cast(int) 0x1AC24696, cast(int) 0xCDB30AEB, cast(int) 0x532E3054, cast(int) 0x8FD948E4, cast(int) 0x6DBC3128, cast(int) 0x58EBF2EF, cast(int) 0x34C6FFEA, cast(int) 0xFE28ED61, cast(int) 0xEE7C3C73, cast(int) 0x5D4A14D9, cast(int) 0xE864B7E3, cast(int) 0x42105D14, cast(int) 0x203E13E0, cast(int) 0x45EEE2B6, cast(int) 0xA3AAABEA, cast(int) 0xDB6C4F15, cast(int) 0xFACB4FD0, cast(int) 0xC742F442, cast(int) 0xEF6ABBB5, cast(int) 0x654F3B1D, cast(int) 0x41CD2105, cast(int) 0xD81E799E, cast(int) 0x86854DC7, cast(int) 0xE44B476A, cast(int) 0x3D816250, cast(int) 0xCF62A1F2, cast(int) 0x5B8D2646, cast(int) 0xFC8883A0, cast(int) 0xC1C7B6A3, cast(int) 0x7F1524C3, cast(int) 0x69CB7492, cast(int) 0x47848A0B, cast(int) 0x5692B285, cast(int) 0x095BBF00, cast(int) 0xAD19489D, cast(int) 0x1462B174, cast(int) 0x23820E00, cast(int) 0x58428D2A, cast(int) 0x0C55F5EA, cast(int) 0x1DADF43E, cast(int) 0x233F7061, cast(int) 0x3372F092, cast(int) 0x8D937E41, cast(int) 0xD65FECF1, cast(int) 0x6C223BDB, cast(int) 0x7CDE3759, cast(int) 0xCBEE7460, cast(int) 0x4085F2A7, cast(int) 0xCE77326E, cast(int) 0xA6078084, cast(int) 0x19F8509E, cast(int) 0xE8EFD855, cast(int) 0x61D99735, cast(int) 0xA969A7AA, cast(int) 0xC50C06C2, cast(int) 0x5A04ABFC, cast(int) 0x800BCADC, cast(int) 0x9E447A2E, cast(int) 0xC3453484, cast(int) 0xFDD56705, cast(int) 0x0E1E9EC9, cast(int) 0xDB73DBD3, cast(int) 0x105588CD, cast(int) 0x675FDA79, cast(int) 0xE3674340, cast(int) 0xC5C43465, cast(int) 0x713E38D8, cast(int) 0x3D28F89E, cast(int) 0xF16DFF20, cast(int) 0x153E21E7, cast(int) 0x8FB03D4A, cast(int) 0xE6E39F2B, cast(int) 0xDB83ADF7 ]; private const int[] KS2 = [ cast(int) 0xE93D5A68, cast(int) 0x948140F7, cast(int) 0xF64C261C, cast(int) 0x94692934, cast(int) 0x411520F7, cast(int) 0x7602D4F7, cast(int) 0xBCF46B2E, cast(int) 0xD4A20068, cast(int) 0xD4082471, cast(int) 0x3320F46A, cast(int) 0x43B7D4B7, cast(int) 0x500061AF, cast(int) 0x1E39F62E, cast(int) 0x97244546, cast(int) 0x14214F74, cast(int) 0xBF8B8840, cast(int) 0x4D95FC1D, cast(int) 0x96B591AF, cast(int) 0x70F4DDD3, cast(int) 0x66A02F45, cast(int) 0xBFBC09EC, cast(int) 0x03BD9785, cast(int) 0x7FAC6DD0, cast(int) 0x31CB8504, cast(int) 0x96EB27B3, cast(int) 0x55FD3941, cast(int) 0xDA2547E6, cast(int) 0xABCA0A9A, cast(int) 0x28507825, cast(int) 0x530429F4, cast(int) 0x0A2C86DA, cast(int) 0xE9B66DFB, cast(int) 0x68DC1462, cast(int) 0xD7486900, cast(int) 0x680EC0A4, cast(int) 0x27A18DEE, cast(int) 0x4F3FFEA2, cast(int) 0xE887AD8C, cast(int) 0xB58CE006, cast(int) 0x7AF4D6B6, cast(int) 0xAACE1E7C, cast(int) 0xD3375FEC, cast(int) 0xCE78A399, cast(int) 0x406B2A42, cast(int) 0x20FE9E35, cast(int) 0xD9F385B9, cast(int) 0xEE39D7AB, cast(int) 0x3B124E8B, cast(int) 0x1DC9FAF7, cast(int) 0x4B6D1856, cast(int) 0x26A36631, cast(int) 0xEAE397B2, cast(int) 0x3A6EFA74, cast(int) 0xDD5B4332, cast(int) 0x6841E7F7, cast(int) 0xCA7820FB, cast(int) 0xFB0AF54E, cast(int) 0xD8FEB397, cast(int) 0x454056AC, cast(int) 0xBA489527, cast(int) 0x55533A3A, cast(int) 0x20838D87, cast(int) 0xFE6BA9B7, cast(int) 0xD096954B, cast(int) 0x55A867BC, cast(int) 0xA1159A58, cast(int) 0xCCA92963, cast(int) 0x99E1DB33, cast(int) 0xA62A4A56, cast(int) 0x3F3125F9, cast(int) 0x5EF47E1C, cast(int) 0x9029317C, cast(int) 0xFDF8E802, cast(int) 0x04272F70, cast(int) 0x80BB155C, cast(int) 0x05282CE3, cast(int) 0x95C11548, cast(int) 0xE4C66D22, cast(int) 0x48C1133F, cast(int) 0xC70F86DC, cast(int) 0x07F9C9EE, cast(int) 0x41041F0F, cast(int) 0x404779A4, cast(int) 0x5D886E17, cast(int) 0x325F51EB, cast(int) 0xD59BC0D1, cast(int) 0xF2BCC18F, cast(int) 0x41113564, cast(int) 0x257B7834, cast(int) 0x602A9C60, cast(int) 0xDFF8E8A3, cast(int) 0x1F636C1B, cast(int) 0x0E12B4C2, cast(int) 0x02E1329E, cast(int) 0xAF664FD1, cast(int) 0xCAD18115, cast(int) 0x6B2395E0, cast(int) 0x333E92E1, cast(int) 0x3B240B62, cast(int) 0xEEBEB922, cast(int) 0x85B2A20E, cast(int) 0xE6BA0D99, cast(int) 0xDE720C8C, cast(int) 0x2DA2F728, cast(int) 0xD0127845, cast(int) 0x95B794FD, cast(int) 0x647D0862, cast(int) 0xE7CCF5F0, cast(int) 0x5449A36F, cast(int) 0x877D48FA, cast(int) 0xC39DFD27, cast(int) 0xF33E8D1E, cast(int) 0x0A476341, cast(int) 0x992EFF74, cast(int) 0x3A6F6EAB, cast(int) 0xF4F8FD37, cast(int) 0xA812DC60, cast(int) 0xA1EBDDF8, cast(int) 0x991BE14C, cast(int) 0xDB6E6B0D, cast(int) 0xC67B5510, cast(int) 0x6D672C37, cast(int) 0x2765D43B, cast(int) 0xDCD0E804, cast(int) 0xF1290DC7, cast(int) 0xCC00FFA3, cast(int) 0xB5390F92, cast(int) 0x690FED0B, cast(int) 0x667B9FFB, cast(int) 0xCEDB7D9C, cast(int) 0xA091CF0B, cast(int) 0xD9155EA3, cast(int) 0xBB132F88, cast(int) 0x515BAD24, cast(int) 0x7B9479BF, cast(int) 0x763BD6EB, cast(int) 0x37392EB3, cast(int) 0xCC115979, cast(int) 0x8026E297, cast(int) 0xF42E312D, cast(int) 0x6842ADA7, cast(int) 0xC66A2B3B, cast(int) 0x12754CCC, cast(int) 0x782EF11C, cast(int) 0x6A124237, cast(int) 0xB79251E7, cast(int) 0x06A1BBE6, cast(int) 0x4BFB6350, cast(int) 0x1A6B1018, cast(int) 0x11CAEDFA, cast(int) 0x3D25BDD8, cast(int) 0xE2E1C3C9, cast(int) 0x44421659, cast(int) 0x0A121386, cast(int) 0xD90CEC6E, cast(int) 0xD5ABEA2A, cast(int) 0x64AF674E, cast(int) 0xDA86A85F, cast(int) 0xBEBFE988, cast(int) 0x64E4C3FE, cast(int) 0x9DBC8057, cast(int) 0xF0F7C086, cast(int) 0x60787BF8, cast(int) 0x6003604D, cast(int) 0xD1FD8346, cast(int) 0xF6381FB0, cast(int) 0x7745AE04, cast(int) 0xD736FCCC, cast(int) 0x83426B33, cast(int) 0xF01EAB71, cast(int) 0xB0804187, cast(int) 0x3C005E5F, cast(int) 0x77A057BE, cast(int) 0xBDE8AE24, cast(int) 0x55464299, cast(int) 0xBF582E61, cast(int) 0x4E58F48F, cast(int) 0xF2DDFDA2, cast(int) 0xF474EF38, cast(int) 0x8789BDC2, cast(int) 0x5366F9C3, cast(int) 0xC8B38E74, cast(int) 0xB475F255, cast(int) 0x46FCD9B9, cast(int) 0x7AEB2661, cast(int) 0x8B1DDF84, cast(int) 0x846A0E79, cast(int) 0x915F95E2, cast(int) 0x466E598E, cast(int) 0x20B45770, cast(int) 0x8CD55591, cast(int) 0xC902DE4C, cast(int) 0xB90BACE1, cast(int) 0xBB8205D0, cast(int) 0x11A86248, cast(int) 0x7574A99E, cast(int) 0xB77F19B6, cast(int) 0xE0A9DC09, cast(int) 0x662D09A1, cast(int) 0xC4324633, cast(int) 0xE85A1F02, cast(int) 0x09F0BE8C, cast(int) 0x4A99A025, cast(int) 0x1D6EFE10, cast(int) 0x1AB93D1D, cast(int) 0x0BA5A4DF, cast(int) 0xA186F20F, cast(int) 0x2868F169, cast(int) 0xDCB7DA83, cast(int) 0x573906FE, cast(int) 0xA1E2CE9B, cast(int) 0x4FCD7F52, cast(int) 0x50115E01, cast(int) 0xA70683FA, cast(int) 0xA002B5C4, cast(int) 0x0DE6D027, cast(int) 0x9AF88C27, cast(int) 0x773F8641, cast(int) 0xC3604C06, cast(int) 0x61A806B5, cast(int) 0xF0177A28, cast(int) 0xC0F586E0, cast(int) 0x006058AA, cast(int) 0x30DC7D62, cast(int) 0x11E69ED7, cast(int) 0x2338EA63, cast(int) 0x53C2DD94, cast(int) 0xC2C21634, cast(int) 0xBBCBEE56, cast(int) 0x90BCB6DE, cast(int) 0xEBFC7DA1, cast(int) 0xCE591D76, cast(int) 0x6F05E409, cast(int) 0x4B7C0188, cast(int) 0x39720A3D, cast(int) 0x7C927C24, cast(int) 0x86E3725F, cast(int) 0x724D9DB9, cast(int) 0x1AC15BB4, cast(int) 0xD39EB8FC, cast(int) 0xED545578, cast(int) 0x08FCA5B5, cast(int) 0xD83D7CD3, cast(int) 0x4DAD0FC4, cast(int) 0x1E50EF5E, cast(int) 0xB161E6F8, cast(int) 0xA28514D9, cast(int) 0x6C51133C, cast(int) 0x6FD5C7E7, cast(int) 0x56E14EC4, cast(int) 0x362ABFCE, cast(int) 0xDDC6C837, cast(int) 0xD79A3234, cast(int) 0x92638212, cast(int) 0x670EFA8E, cast(int) 0x406000E0 ]; private const int[] KS3 = [ cast(int) 0x3A39CE37, cast(int) 0xD3FAF5CF, cast(int) 0xABC27737, cast(int) 0x5AC52D1B, cast(int) 0x5CB0679E, cast(int) 0x4FA33742, cast(int) 0xD3822740, cast(int) 0x99BC9BBE, cast(int) 0xD5118E9D, cast(int) 0xBF0F7315, cast(int) 0xD62D1C7E, cast(int) 0xC700C47B, cast(int) 0xB78C1B6B, cast(int) 0x21A19045, cast(int) 0xB26EB1BE, cast(int) 0x6A366EB4, cast(int) 0x5748AB2F, cast(int) 0xBC946E79, cast(int) 0xC6A376D2, cast(int) 0x6549C2C8, cast(int) 0x530FF8EE, cast(int) 0x468DDE7D, cast(int) 0xD5730A1D, cast(int) 0x4CD04DC6, cast(int) 0x2939BBDB, cast(int) 0xA9BA4650, cast(int) 0xAC9526E8, cast(int) 0xBE5EE304, cast(int) 0xA1FAD5F0, cast(int) 0x6A2D519A, cast(int) 0x63EF8CE2, cast(int) 0x9A86EE22, cast(int) 0xC089C2B8, cast(int) 0x43242EF6, cast(int) 0xA51E03AA, cast(int) 0x9CF2D0A4, cast(int) 0x83C061BA, cast(int) 0x9BE96A4D, cast(int) 0x8FE51550, cast(int) 0xBA645BD6, cast(int) 0x2826A2F9, cast(int) 0xA73A3AE1, cast(int) 0x4BA99586, cast(int) 0xEF5562E9, cast(int) 0xC72FEFD3, cast(int) 0xF752F7DA, cast(int) 0x3F046F69, cast(int) 0x77FA0A59, cast(int) 0x80E4A915, cast(int) 0x87B08601, cast(int) 0x9B09E6AD, cast(int) 0x3B3EE593, cast(int) 0xE990FD5A, cast(int) 0x9E34D797, cast(int) 0x2CF0B7D9, cast(int) 0x022B8B51, cast(int) 0x96D5AC3A, cast(int) 0x017DA67D, cast(int) 0xD1CF3ED6, cast(int) 0x7C7D2D28, cast(int) 0x1F9F25CF, cast(int) 0xADF2B89B, cast(int) 0x5AD6B472, cast(int) 0x5A88F54C, cast(int) 0xE029AC71, cast(int) 0xE019A5E6, cast(int) 0x47B0ACFD, cast(int) 0xED93FA9B, cast(int) 0xE8D3C48D, cast(int) 0x283B57CC, cast(int) 0xF8D56629, cast(int) 0x79132E28, cast(int) 0x785F0191, cast(int) 0xED756055, cast(int) 0xF7960E44, cast(int) 0xE3D35E8C, cast(int) 0x15056DD4, cast(int) 0x88F46DBA, cast(int) 0x03A16125, cast(int) 0x0564F0BD, cast(int) 0xC3EB9E15, cast(int) 0x3C9057A2, cast(int) 0x97271AEC, cast(int) 0xA93A072A, cast(int) 0x1B3F6D9B, cast(int) 0x1E6321F5, cast(int) 0xF59C66FB, cast(int) 0x26DCF319, cast(int) 0x7533D928, cast(int) 0xB155FDF5, cast(int) 0x03563482, cast(int) 0x8ABA3CBB, cast(int) 0x28517711, cast(int) 0xC20AD9F8, cast(int) 0xABCC5167, cast(int) 0xCCAD925F, cast(int) 0x4DE81751, cast(int) 0x3830DC8E, cast(int) 0x379D5862, cast(int) 0x9320F991, cast(int) 0xEA7A90C2, cast(int) 0xFB3E7BCE, cast(int) 0x5121CE64, cast(int) 0x774FBE32, cast(int) 0xA8B6E37E, cast(int) 0xC3293D46, cast(int) 0x48DE5369, cast(int) 0x6413E680, cast(int) 0xA2AE0810, cast(int) 0xDD6DB224, cast(int) 0x69852DFD, cast(int) 0x09072166, cast(int) 0xB39A460A, cast(int) 0x6445C0DD, cast(int) 0x586CDECF, cast(int) 0x1C20C8AE, cast(int) 0x5BBEF7DD, cast(int) 0x1B588D40, cast(int) 0xCCD2017F, cast(int) 0x6BB4E3BB, cast(int) 0xDDA26A7E, cast(int) 0x3A59FF45, cast(int) 0x3E350A44, cast(int) 0xBCB4CDD5, cast(int) 0x72EACEA8, cast(int) 0xFA6484BB, cast(int) 0x8D6612AE, cast(int) 0xBF3C6F47, cast(int) 0xD29BE463, cast(int) 0x542F5D9E, cast(int) 0xAEC2771B, cast(int) 0xF64E6370, cast(int) 0x740E0D8D, cast(int) 0xE75B1357, cast(int) 0xF8721671, cast(int) 0xAF537D5D, cast(int) 0x4040CB08, cast(int) 0x4EB4E2CC, cast(int) 0x34D2466A, cast(int) 0x0115AF84, cast(int) 0xE1B00428, cast(int) 0x95983A1D, cast(int) 0x06B89FB4, cast(int) 0xCE6EA048, cast(int) 0x6F3F3B82, cast(int) 0x3520AB82, cast(int) 0x011A1D4B, cast(int) 0x277227F8, cast(int) 0x611560B1, cast(int) 0xE7933FDC, cast(int) 0xBB3A792B, cast(int) 0x344525BD, cast(int) 0xA08839E1, cast(int) 0x51CE794B, cast(int) 0x2F32C9B7, cast(int) 0xA01FBAC9, cast(int) 0xE01CC87E, cast(int) 0xBCC7D1F6, cast(int) 0xCF0111C3, cast(int) 0xA1E8AAC7, cast(int) 0x1A908749, cast(int) 0xD44FBD9A, cast(int) 0xD0DADECB, cast(int) 0xD50ADA38, cast(int) 0x0339C32A, cast(int) 0xC6913667, cast(int) 0x8DF9317C, cast(int) 0xE0B12B4F, cast(int) 0xF79E59B7, cast(int) 0x43F5BB3A, cast(int) 0xF2D519FF, cast(int) 0x27D9459C, cast(int) 0xBF97222C, cast(int) 0x15E6FC2A, cast(int) 0x0F91FC71, cast(int) 0x9B941525, cast(int) 0xFAE59361, cast(int) 0xCEB69CEB, cast(int) 0xC2A86459, cast(int) 0x12BAA8D1, cast(int) 0xB6C1075E, cast(int) 0xE3056A0C, cast(int) 0x10D25065, cast(int) 0xCB03A442, cast(int) 0xE0EC6E0E, cast(int) 0x1698DB3B, cast(int) 0x4C98A0BE, cast(int) 0x3278E964, cast(int) 0x9F1F9532, cast(int) 0xE0D392DF, cast(int) 0xD3A0342B, cast(int) 0x8971F21E, cast(int) 0x1B0A7441, cast(int) 0x4BA3348C, cast(int) 0xC5BE7120, cast(int) 0xC37632D8, cast(int) 0xDF359F8D, cast(int) 0x9B992F2E, cast(int) 0xE60B6F47, cast(int) 0x0FE3F11D, cast(int) 0xE54CDA54, cast(int) 0x1EDAD891, cast(int) 0xCE6279CF, cast(int) 0xCD3E7E6F, cast(int) 0x1618B166, cast(int) 0xFD2C1D05, cast(int) 0x848FD2C5, cast(int) 0xF6FB2299, cast(int) 0xF523F357, cast(int) 0xA6327623, cast(int) 0x93A83531, cast(int) 0x56CCCD02, cast(int) 0xACF08162, cast(int) 0x5A75EBB5, cast(int) 0x6E163697, cast(int) 0x88D273CC, cast(int) 0xDE966292, cast(int) 0x81B949D0, cast(int) 0x4C50901B, cast(int) 0x71C65614, cast(int) 0xE6C6C7BD, cast(int) 0x327A140A, cast(int) 0x45E1D006, cast(int) 0xC3F27B9A, cast(int) 0xC9AA53FD, cast(int) 0x62A80F00, cast(int) 0xBB25BFE2, cast(int) 0x35BDD2F6, cast(int) 0x71126905, cast(int) 0xB2040222, cast(int) 0xB6CBCF7C, cast(int) 0xCD769C2B, cast(int) 0x53113EC0, cast(int) 0x1640E3D3, cast(int) 0x38ABBD60, cast(int) 0x2547ADF0, cast(int) 0xBA38209C, cast(int) 0xF746CE76, cast(int) 0x77AFA1C5, cast(int) 0x20756060, cast(int) 0x85CBFE4E, cast(int) 0x8AE88DD8, cast(int) 0x7AAAF9B0, cast(int) 0x4CF9AA7E, cast(int) 0x1948C25C, cast(int) 0x02FB8A8C, cast(int) 0x01C36AE4, cast(int) 0xD6EBE1F9, cast(int) 0x90D4F869, cast(int) 0xA65CDEA0, cast(int) 0x3F09252D, cast(int) 0xC208E69F, cast(int) 0xB74E6132, cast(int) 0xCE77E25B, cast(int) 0x578FDFE3, cast(int) 0x3AC372E6 ]; //==================================== // Useful constants //==================================== private static const int ROUNDS = 16; private static const int BLOCK_SIZE = 8; // bytes = 64 bits private static const int SBOX_SK = 256; private static const int P_SZ = ROUNDS+2; private const int[] S0, S1, S2, S3; // the s-boxes private const int[] P; // the p-array private bool encrypting = false; private ubyte[] workingKey = null; public this() { S0 = new int[SBOX_SK]; S1 = new int[SBOX_SK]; S2 = new int[SBOX_SK]; S3 = new int[SBOX_SK]; P = new int[P_SZ]; } public this(bool encrypting, ubyte[] key) { S0 = new int[SBOX_SK]; S1 = new int[SBOX_SK]; S2 = new int[SBOX_SK]; S3 = new int[SBOX_SK]; P = new int[P_SZ]; init(encrypting, key); } /** * initialise a Blowfish cipher. * * param forEncryption whether or not we are for encryption. * param params the parameters required to set up the cipher. * exception IllegalArgumentException if the params argument is * inappropriate. */ public void init(bool encrypting, ubyte[] key=null) { if (key != null) { this.encrypting = encrypting; this.workingKey = key; setKey(this.workingKey); } else throw new Exception("invalid parameter passed to Blowfish init - key"); } public char[] getAlgorithmName() { return "Blowfish"; } public int processBlock(ubyte[] inBytes, int inOff, inout ubyte[] outBytes, int outOff) { if (workingKey == null) { throw new Exception("Blowfish not initialised"); } if(inBytes.length == 0) { throw new Exception("input buffer too short"); } if ((inOff + BLOCK_SIZE) > inBytes.length) { throw new Exception("input buffer too short"); } if ((outOff + BLOCK_SIZE) > outBytes.length) { outBytes.length = (outOff + BLOCK_SIZE); } if (encrypting) { encryptBlock(inBytes, inOff, outBytes, outOff); } else { decryptBlock(inBytes, inOff, outBytes, outOff); } return BLOCK_SIZE; } public int processBlock(ubyte[] inBytes, inout ubyte[] outBytes) { int pad = 0; int inOff = 0; if(workingKey == null) { throw new Exception("Blowfish not initialised"); } if(inBytes.length == 0) { throw new Exception("input buffer too short"); } pad = inBytes.length % BLOCK_SIZE; if(pad != 0) { pad = BLOCK_SIZE - pad; while(inOff < pad) { inBytes ~= 0x0; inOff++; } } outBytes.length = inBytes.length; inOff = 0; while(inOff < inBytes.length) { if(encrypting) { encryptBlock(inBytes, inOff, outBytes, inOff); } else { decryptBlock(inBytes, inOff, outBytes, inOff); } inOff += BLOCK_SIZE; } return inBytes.length; } public void reset() { } public int getBlockSize() { return BLOCK_SIZE; } //================================== // Private Implementation //================================== private int F(int x) { return (((S0[(cast(uint) x >> 24)] + S1[(cast(uint) x >> 16) & 0xff]) ^ S2[(cast(uint) x >> 8) & 0xff]) + S3[x & 0xff]); } /** * apply the encryption cycle to each value pair in the table. */ private void processTable(int xl, int xr, int[] table) { int size = table.length; for (int s = 0; s < size; s += 2) { xl ^= P[0]; for (int i = 1; i < ROUNDS; i += 2) { xr ^= F(xl) ^ P[i]; xl ^= F(xr) ^ P[i + 1]; } xr ^= P[ROUNDS + 1]; table[s] = xr; table[s + 1] = xl; xr = xl; // end of cycle swap xl = table[s]; } } private void setKey(ubyte[] key) { /* * - comments are from _Applied Crypto_, Schneier, p338 * please be careful comparing the two, AC numbers the * arrays from 1, the enclosed code from 0. * * (1) * Initialise the S-boxes and the P-array, with a fixed string * This string contains the hexadecimal digits of pi (3.141...) */ //Array.Copy(KS0, 0, S0, 0, SBOX_SK); S0[0..SBOX_SK] = KS0; //Array.Copy(KS1, 0, S1, 0, SBOX_SK); S1[0..SBOX_SK] = KS1; //Array.Copy(KS2, 0, S2, 0, SBOX_SK); S2[0..SBOX_SK] = KS2; //Array.Copy(KS3, 0, S3, 0, SBOX_SK); S3[0..SBOX_SK] = KS3; //Array.Copy(KP, 0, P, 0, P_SZ); P[0..P_SZ] = KP; /* * (2) * Now, XOR P[0] with the first 32 bits of the key, XOR P[1] with the * second 32-bits of the key, and so on for all bits of the key * (up to P[17]). Repeatedly cycle through the key bits until the * entire P-array has been XOR-ed with the key bits */ int keyLength = key.length; int keyIndex = 0; for (int i=0; i < P_SZ; i++) { // get the 32 bits of the key, in 4 * 8 bit chunks int data = cast(int) 0x0000000; for (int j=0; j < 4; j++) { // create a 32 bit block data = (data << 8) | (key[keyIndex++] & 0xff); // wrap when we get to the end of the key if (keyIndex >= keyLength) { keyIndex = 0; } } // XOR the newly created 32 bit chunk onto the P-array P[i] ^= data; } /* * (3) * Encrypt the all-zero string with the Blowfish algorithm, using * the subkeys described in (1) and (2) * * (4) * Replace P1 and P2 with the output of step (3) * * (5) * Encrypt the output of step(3) using the Blowfish algorithm, * with the modified subkeys. * * (6) * Replace P3 and P4 with the output of step (5) * * (7) * Continue the process, replacing all elements of the P-array * and then all four S-boxes in order, with the output of the * continuously changing Blowfish algorithm */ processTable(0, 0, P); processTable(P[P_SZ - 2], P[P_SZ - 1], S0); processTable(S0[SBOX_SK - 2], S0[SBOX_SK - 1], S1); processTable(S1[SBOX_SK - 2], S1[SBOX_SK - 1], S2); processTable(S2[SBOX_SK - 2], S2[SBOX_SK - 1], S3); } /** * Encrypt the given input starting at the given offset and place * the result in the provided buffer starting at the given offset. * The input will be an exact multiple of our blocksize. */ private void encryptBlock(ubyte[] src, int srcIndex, ubyte[] dst, int dstIndex) { int xl = BytesTo32bits(src, srcIndex); int xr = BytesTo32bits(src, srcIndex+4); xl ^= P[0]; for (int i = 1; i < ROUNDS; i += 2) { xr ^= F(xl) ^ P[i]; xl ^= F(xr) ^ P[i + 1]; } xr ^= P[ROUNDS + 1]; Bits32ToBytes(xr, dst, dstIndex); Bits32ToBytes(xl, dst, dstIndex + 4); } /** * Decrypt the given input starting at the given offset and place * the result in the provided buffer starting at the given offset. * The input will be an exact multiple of our blocksize. */ private void decryptBlock(ubyte[] src, int srcIndex, ubyte[] dst, int dstIndex) { int xl = BytesTo32bits(src, srcIndex); int xr = BytesTo32bits(src, srcIndex + 4); xl ^= P[ROUNDS + 1]; for (int i = ROUNDS; i > 0 ; i -= 2) { xr ^= F(xl) ^ P[i]; xl ^= F(xr) ^ P[i - 1]; } xr ^= P[0]; Bits32ToBytes(xr, dst, dstIndex); Bits32ToBytes(xl, dst, dstIndex+4); } private int BytesTo32bits(ubyte[] b, int i) { return ((b[i] & 0xff) << 24) | ((b[i+1] & 0xff) << 16) | ((b[i+2] & 0xff) << 8) | ((b[i+3] & 0xff)); } private void Bits32ToBytes(int inData, ubyte[] b, int offset) { b[offset + 3] = cast(ubyte)inData; b[offset + 2] = cast(ubyte)(inData >> 8); b[offset + 1] = cast(ubyte)(inData >> 16); b[offset] = cast(ubyte)(inData >> 24); } } int main() { ubyte[] bkey; ubyte[] ins; ubyte[] outs; ubyte[] xx; bkey.length = 8; ins.length = 17; outs.length = 32; xx.length = 32; bkey = cast(ubyte[])"xxxxxxxx"; ins = cast(ubyte[])"ttttttttttttttttz"; /* working BlowfishEngine bl; bl = new BlowfishEngine(); bl.init(true, bkey); bl.processBlock(ins, outs); printf(">| %s\n", toStringz(cast(char[])outs)); BlowfishEngine bl1; bl1 = new BlowfishEngine(); bl1.init(false, bkey); bl1.processBlock(outs, xx); printf(">| %s\n", toStringz(cast(char[])xx)); return 1; }
Mar 23 2006
sorry i tried to attach, but it did not work. little over 19k encryped old datagrams work to be decrypted, encrypted and compared. need them to go from modula-2 to d. maybe someone else sees the need to convert some others ... i use the cryptosys pki lib for the rest i don't have yet and try to attach the d header. funny i write that now for the second time, i hope it will end up in the ng r begin 0644 diCrPKI.d M14-265!4("` /2` ,#L- M;G0 4$M)7T1%1D%53%0 ("` ("` (#T ,#L-"F-O;G-T(&EN="!02TE?4TE' M7U-(03%24T$ ("` /2`P.PT*8V]N<W0 :6YT(%!+25]324=?340U4E-!("` M;G-T(&EN="!02TE?4$)%7U-(05\S1$53("` /2`P.PT*8V]N<W0 :6YT(%!+ M1$53("` (#T ,CL-"F-O;G-T(&EN="!02TE?4$)%7U-(05]$15, ("` /2`S M340U("` /2`Q.PT*8V]N<W0 :6YT(%!+25](05-(7TU$,B` (#T ,CL-"F-O M(&9O<B!24T$ 97AP;VYE;G0 *B\-"F-O;G-T(&EN="!02TE?4E-!15A07T51 M/2`Q.PT*8V]N<W0 :6YT(%!+25]24T%%6%!?15%?,3< ("` (#T ,CL-"F-O M14Q!62` ("` (#T ,' R,#L-"F-O;G-T(&EN="!02TE?2T597T9/4DU!5%]0 M3"` (#T M15D)(#T M7T--4U])3D-,541%7T%45%)3("` ("` (#T M7UA-3%]24T%+15E604Q512` (#T M4$M)7U U,#E?5D524TE/3C$ ("` ("` ("` (#T M8V]N<W0 :6YT(%!+25]%345?1$5&055,5"` ("` ("` (#T M="!I;G0 4$M)7T5-4TE'7T1)1TE.1D\ ("` (#T M1FQA9W, 9F]R($ME>2!5<V%G92`J+PT*8V]N<W0 :6YT(%!+25]8-3`Y7TM% M;G0 4$M)7U U,#E?2T5955-!1T5?3D].4D50541)051)3TX ("` (#T ,' P M4$M)7U U,#E?2T5955-!1T5?2T5904=2145-14Y4("` ("` (#T M3#L- M7U U,#E M" T*9FEN86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7U9E<G-I M;VXH:6YT("IN36%J;W(L(&EN="`J;DUI;F]R*3L-"F9I;F%L(&5X=&5R;BA7 M:6YD;W=S*2!E>'!O<G0 :6YT(%!+25],:6-E;F-E5'EP92AI;G0 <F5S97)V M960I.PT*9FEN86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7TQA M<W1%<G)O<BAC:&%R("IS>D5R<DUS9RP :6YT(&Y-<V=,96XI.PT*9FEN86P M97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7T5R<F]R0V]D92 I.PT* M9FEN86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7T5R<F]R3&]O M:6QE5&EM92AC:&%R("IS>E1I;65S=&%M<"P :6YT(&Y,96XI.PT*9FEN86P M97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7TUO9'5L94YA;64H8VAA M<B`J<WI4:6UE<W1A;7`L(&EN="!N3&5N+"!I;G0 <F5S97)V960I.PT*9FEN M86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$M)7U!O=V5R57!497-T M<U-E960L(&EN="!N4V5E9$QE;BP :6YT(&Y/<'1I;VYS*3L-"F9I;F%L(&5X M=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT($--4U]-86ME16YV1&%T849R;VU3 M=')I;F<H8VAA<B`J<WI&:6QE3W5T+"!C:&%R("IS>D1A=&%);BP 8VAA<B`J M<'1I;VYS*3L-"F9I;F%L(&5X=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT($-- M4U]296%D16YV1&%T82AC:&%R("IS>D9I;&5/=70L(&-H87( *G-Z1FEL94EN M+"!C:&%R("IS>E U,#E&:6QE+"!C:&%R("IS>E)305!R:79A=&5+97DL(&EN M;&4L(&-H87( *G-Z4E-!4')I=F%T94ME>2P :6YT(&Y/<'1I;VYS*3L-"F9I M;F%L(&5X=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT($--4U]-86ME4VEG1&%T M82AC:&%R("IS>D9I;&5/=70L(&-H87( *G-Z1FEL94EN+"!C:&%R("IS>D-E M<G1,:7-T+"!C:&%R("IS>E)305!R:79A=&5+97DL(&EN="!N3W!T:6]N<RD[ M9T1A=&%&<F]M4W1R:6YG*&-H87( *G-Z1FEL94]U="P 8VAA<B`J<WI$871A M26XL(&-H87( *G-Z0V5R=$QI<W0L(&-H87( *G-Z4E-!4')I=F%T94ME>2P M:6YT(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24T%?4F%W4'5B;&EC*'5B M>71E("IA8D1A=&$L(&EN="!N1&%T84QE;BP 8VAA<B`J<WI0=6)L:6-+97DV M-"P :6YT(&Y/<'1I;VYS*3L-"F9I;F%L(&5X=&5R;BA7:6YD;W=S*2!E>'!O M<G0 :6YT(%)305]287=0<FEV871E*'5B>71E("IA8D1A=&$L(&EN="!N1&%T M:6YA;"!E>'1E<FXH5VEN9&]W<RD 97AP;W)T(&EN="!24T%?16YC;V1E37-G M*'5B>71E("IA8D]U='!U="P :6YT(&Y/=71P=71,96XL("!U8GET92`J86)- M97-S86=E+"!I;G0 ;DUS9TQE;BP :6YT(&Y/<'1I;VYS*3L-"F9I;F%L(&5X M=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT(%)305]$96-O9&5-<V<H=6)Y=&4 M*F%B3W5T<'5T+"!I;G0 ;D]U='!U=$QE;BP ('5B>71E("IA8DEN<'5T+"!I M97)T1FEL92P (&-H87( *G-Z2V5Y1FEL92P (&-H87( *G-Z4&%S<W=O<F0L M("!C:&%R("IS>D9R:65N9&QY3F%M92P :6YT(&]P=&EO;G,I.PT*9FEN86P M97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 4$987U9E<FEF>5-I9R 8VAA M<B`J<WI&:6QE3F%M92P (&-H87( *G-Z4&%S<W=O<F0L(&EN="!O<'1I;VYS M(&5X=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT(% U,#E?36%K94-E<G0H8VAA M<B`J8V5R=&9I;&4L(&-H87( *FES<W5E<D-E<G0L(&-H87( *G-U8FIE8W10 M=6)K97E&:6QE+"!C:&%R("II<W-U97)0=FM);F9O1FEL92P :6YT(&-E<G1N M=6TL(&EN="!Y96%R<W9A;&ED+"!C:&%R("ID:7-T3F%M92P 8VAA<B`J96UA M:6PL(&EN="!K97E5<V%G949L86=S+"!C:&%R("IP87-S=V]R9"P :6YT(&]P M=&EO;D9L86=S*3L-"F9I;F%L(&5X=&5R;BA7:6YD;W=S*2!E>'!O<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?2&5X1G)O;49I M;&4H8VAA<B`J<WI(97A$:6=E<W0L(&EN="!D:6=,96XL("!C:&%R("IS>D9I M;&5.86UE+"!I;G0 9FQA9W,I.PT*9FEN86P 97AT97)N*%=I;F1O=W,I(&5X M<&]R="!I;G0 2$%32%]">71E<RAU8GET92`J9&EG97-T+"!I;G0 9&EG3&5N M+"` =F]I9"`J84UE<W-A9V4L(&EN="!M97-S86=E3&5N+"!I;G0 9FQA9W,I M.PT*9FEN86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 2$%32%]&:6QE M*'5B>71E("ID:6=E<W0L(&EN="!D:6=,96XL("!C:&%R("IS>D9I;&5.86UE M97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 5TE015]&:6QE*&-H87( *G-Z M97AP;W)T(&EN="!725!%7T1A=&$H=F]I9"`J;'!$871A+"!I;G0 9&%T86QE M97,H=6)Y=&4 *F]U='!U="P :6YT(&]U=%]L96XL(&-H87( *G-E960L(&EN M="!S965D;&5N*3L-"F9I;F%L(&5X=&5R;BA7:6YD;W=S*2!E>'!O<G0 :6YT M(%!71%]0<F]M<'0H8VAA<B`J<WI087-S=V]R9"P :6YT(&Y0=V1,96XL(&-H M(&EN="!05T1?4')O;7!T17 H8VAA<B`J<WI087-S=V]R9"P :6YT(&Y0=V1, M96XL(&-H87( *G-Z0V%P=&EO;BP 8VAA<B`J<WI0<F]M<'0L(&EN="!F;&%G M4W1R1G)O;4)Y=&5S*&-H87( *F]U='!U="P :6YT(&]U=%]L96XL('5B>71E M8VAA<B`J:6YP=70L(&EN="!L96XI.PT*9FEN86P 97AT97)N*%=I;F1O=W,I M(&5X<&]R="!I;G0 0TY67TAE>%-T<D9R;VU">71E<RAC:&%R("IO=71P=70L M(&EN="!O=71?;&5N+"!U8GET92`J:6YP=70L(&EN="!I;E]L96XI.PT*9FEN M86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 0TY67T)Y=&5S1G)O;4AE M>%-T<BAU8GET92`J;W5T<'5T+"!I;G0 ;W5T7VQE;BP 8VAA<B`J:6YP=70I M.PT*9FEN86P 97AT97)N*%=I;F1O=W,I(&5X<&]R="!I;G0 0TY67TAE>$9I M;'1E<BAC:&%R("IO=71P=70L(&-H87( *FEN<'5T+"!I;G0 ;&5N*3L-" T* M;BA7:6YD;W=S*2!E>'!O<G0 :6YT($-.5E]55$8X1G)O;4QA=&EN,2AC:&%R M;5541C H8VAA<B`J<WI/=71P=70L(&EN="!N3W5T0VAA<G,L(&-H87( *G-Z )26YP=70I.PT* ` end
Mar 23 2006
sorry forgot the link http://www.cryptosys.net/pki/ for cryptolib r
Mar 23 2006
You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it. Regan
Mar 23 2006
Regan Heath wrote:You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it. ReganWoo Hoo! Definitely send the crypto stuff to Ares if Sean will have it. I have a blowfish algorithm that I'm working on - not sure how it stacks up with 'r's version, but a consistent API for all of the crypto algorithms would be great. encryptString(char|wchar|dchar) decryptString(char|wchar|dchar) encryptFile() decryptFile() I'm not sure if this 'consistent' API is possible given the differences in the crypto libs, or if it's a good idea at all. BA
Mar 23 2006
On Thu, 23 Mar 2006 17:00:40 -0600, Brad Anderson wrote:Regan Heath wrote:Need to cater for non-text data too. encryptData(ubyte[]) decryptData(ubyte[]) -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 24/03/2006 10:03:21 AMYou might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it. ReganWoo Hoo! Definitely send the crypto stuff to Ares if Sean will have it. I have a blowfish algorithm that I'm working on - not sure how it stacks up with 'r's version, but a consistent API for all of the crypto algorithms would be great. encryptString(char|wchar|dchar) decryptString(char|wchar|dchar) encryptFile() decryptFile() I'm not sure if this 'consistent' API is possible given the differences in the crypto libs, or if it's a good idea at all.
Mar 23 2006
Brad Anderson wrote:Regan Heath wrote:I think it would be useful to have both standalone functions and filters for IO. However, I think "standalone functions" may be a bit misleading, as some attention should probably be paid to supporting different encoding schemes and such with the same basic interface. I don't have a tremendous amount of experience here, but I suppose the .NET API might be one model to consider. The easiest thing in Ares terms might be to consider this an add-on library, since crypto is probably not so essential that it should be considered a core component. So interface consistency would be an ultimate goal, but it wouldn't be tied to the core library release schedule. This would also make it easier to offer this as a standalone library for those who prefer Phobos. Does this sound reasonable? SeanYou might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.Woo Hoo! Definitely send the crypto stuff to Ares if Sean will have it. I have a blowfish algorithm that I'm working on - not sure how it stacks up with 'r's version, but a consistent API for all of the crypto algorithms would be great. encryptString(char|wchar|dchar) decryptString(char|wchar|dchar) encryptFile() decryptFile() I'm not sure if this 'consistent' API is possible given the differences in the crypto libs, or if it's a good idea at all.
Mar 23 2006
Regan Heath wrote:You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion. Sean
Mar 23 2006
Sean Kelly wrote:Regan Heath wrote:I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being? Should only need support for void[], right?You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion. Sean
Mar 23 2006
kris wrote:Sean Kelly wrote:Definately. As I mentioned in my other post, I'd like to have a crypto filter anyway :-)Regan Heath wrote:I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being?You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion.Should only need support for void[], right?Aye. Sean
Mar 23 2006
On Thu, 23 Mar 2006 15:15:03 -0800, kris <foo bar.com> wrote:Sean Kelly wrote:(this is essentially a reply to everyone on this thread) Yes, I believe so. Kris you're welcome to place the crypto code I wrote into Mango. I believe I put a BSD stlye license on it, let me know if that is a problem. The interface I used is essentially the same as the std.md5 one in phobos. It's all done with structs and mixins (which essentially emulates class inheritance). The reason I used structs was to make it easy to copy/store a hash state i.e. you just assign one MD5 to another and it copies the context data. Not sure if that is a good enough reason now, perhaps classes with dup methods would be better. Essentially there are some basic methods: void start(); void update(void[] input); void finish(T digest); void sum(T digest, void[] input); which are mixed into the real implementation. The idea behind these methods is that you can call "sum" if you have all the data at once (sum calls the other 3, meaning you cannot mix it with calls to the other), or you can call start, then update any number of times, and finally finish. The latter 3 methods make it easy to integrate with a stream, for example. Each real implementation defines a trasform method in the form: void transform(ubyte[] input); which is called by the mixed methods to process the data, in addition the following methods: void padMessage(ubyte[] at); void padLength(ubyte[] at, ulong length); are called to perform the padding, and: void extend(); was required to handle MD2 being a little different to the others. This design pattern and interface works for: MD2, MD4, MD5, SHA0, SHA1, SHA256, SHA512, and Tiger. Does it work for blowfish as well? What does the .NET API look like? ReganRegan Heath wrote:I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being? Should only need support for void[], right?You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion. Sean
Mar 23 2006
Regan Heath wrote:On Thu, 23 Mar 2006 15:15:03 -0800, kris <foo bar.com> wrote:That all sounds great (though I'll admit to being more than a bit leery of D mixins). I'll take a look at the license, and get back to you via the Deimos forum? - KrisSean Kelly wrote:(this is essentially a reply to everyone on this thread) Yes, I believe so. Kris you're welcome to place the crypto code I wrote into Mango. I believe I put a BSD stlye license on it, let me know if that is a problem. The interface I used is essentially the same as the std.md5 one in phobos. It's all done with structs and mixins (which essentially emulates class inheritance). The reason I used structs was to make it easy to copy/store a hash state i.e. you just assign one MD5 to another and it copies the context data. Not sure if that is a good enough reason now, perhaps classes with dup methods would be better. Essentially there are some basic methods: void start(); void update(void[] input); void finish(T digest); void sum(T digest, void[] input); which are mixed into the real implementation. The idea behind these methods is that you can call "sum" if you have all the data at once (sum calls the other 3, meaning you cannot mix it with calls to the other), or you can call start, then update any number of times, and finally finish. The latter 3 methods make it easy to integrate with a stream, for example. Each real implementation defines a trasform method in the form: void transform(ubyte[] input); which is called by the mixed methods to process the data, in addition the following methods: void padMessage(ubyte[] at); void padLength(ubyte[] at, ulong length); are called to perform the padding, and: void extend(); was required to handle MD2 being a little different to the others. This design pattern and interface works for: MD2, MD4, MD5, SHA0, SHA1, SHA256, SHA512, and Tiger. Does it work for blowfish as well? What does the .NET API look like? ReganRegan Heath wrote:I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being? Should only need support for void[], right?You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion. Sean
Mar 23 2006
On Thu, 23 Mar 2006 16:20:02 -0800, kris <foo bar.com> wrote:That all sounds great (though I'll admit to being more than a bit leery of D mixins). I'll take a look at the license, and get back to you via the Deimos forum?I just went ahead and converted my hashing code from the struct+mixin approach to a class+factory approach. The source included in the attached zip file hash.zip is public domain, this includes: base.d factory.d md2.d md4.d md5.d sha0.d sha1.d sha256.d sha512.d tiger.d I would very much like to see my code appear in any library that needs/wants it. It'd be nice to get a mention somewhere too, y'know for my ego n'all. Regan
Mar 27 2006
Regan Heath wrote:On Thu, 23 Mar 2006 16:20:02 -0800, kris <foo bar.com> wrote:Nice! It's now got a home in mango.crypto.* - KrisThat all sounds great (though I'll admit to being more than a bit leery of D mixins). I'll take a look at the license, and get back to you via the Deimos forum?I just went ahead and converted my hashing code from the struct+mixin approach to a class+factory approach. The source included in the attached zip file hash.zip is public domain, this includes: base.d factory.d md2.d md4.d md5.d sha0.d sha1.d sha256.d sha512.d tiger.d I would very much like to see my code appear in any library that needs/wants it. It'd be nice to get a mention somewhere too, y'know for my ego n'all. Regan
Mar 27 2006
kris wrote:Sean Kelly wrote:As I foresee the eventual oneness of Ares + Mango, sure.Regan Heath wrote:I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being? Should only need support for void[], right?You might be interested in some existing crypto work I've done: http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/ The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion. Sean
Mar 23 2006