├── .gitignore ├── Ciphers ├── DCPblowfish.inc ├── DCPblowfish.pas ├── DCPcast128.inc ├── DCPcast128.pas ├── DCPcast256.inc ├── DCPcast256.pas ├── DCPdes.inc ├── DCPdes.pas ├── DCPgost.inc ├── DCPgost.pas ├── DCPice.pas ├── DCPidea.pas ├── DCPmars.inc ├── DCPmars.pas ├── DCPmisty1.inc ├── DCPmisty1.pas ├── DCPrc2.inc ├── DCPrc2.pas ├── DCPrc4.pas ├── DCPrc5.pas ├── DCPrc6.pas ├── DCPrijndael.inc ├── DCPrijndael.pas ├── DCPserpent.pas ├── DCPtea.pas ├── DCPtwofish.inc └── DCPtwofish.pas ├── DCP.inc ├── DCPbase64.pas ├── DCPbase64_new.pas ├── DCPblockciphers.pas ├── DCPciphers.dcr ├── DCPconst.pas ├── DCPcppbuilder5.bpk ├── DCPcppbuilder5.cpp ├── DCPcppbuilder5.res ├── DCPcrypt2.pas ├── DCPdelphi2007.cfg ├── DCPdelphi2007.dof ├── DCPdelphi2007.dpk ├── DCPdelphi2007.dproj ├── DCPdelphi2007.res ├── DCPdelphi2009.cfg ├── DCPdelphi2009.dof ├── DCPdelphi2009.dpk ├── DCPdelphi2009.dproj ├── DCPdelphi2009.res ├── DCPdelphi4.cfg ├── DCPdelphi4.dof ├── DCPdelphi4.dpk ├── DCPdelphi4.res ├── DCPdelphi5.cfg ├── DCPdelphi5.dof ├── DCPdelphi5.dpk ├── DCPdelphi5.res ├── DCPdelphi6.cfg ├── DCPdelphi6.dof ├── DCPdelphi6.dpk ├── DCPdelphi6.res ├── DCPdelphiBerlin.dpk ├── DCPdelphiBerlin.dproj ├── DCPdelphiBerlin.res ├── DCPdelphiRio.dpk ├── DCPdelphiRio.dproj ├── DCPdelphiRio.res ├── DCPdelphiTokyo.dpk ├── DCPdelphiTokyo.dproj ├── DCPdelphiTokyo.res ├── DCPdelphiXE.dpk ├── DCPdelphiXE.dproj ├── DCPdelphiXE.res ├── DCPdelphiXE10.dpk ├── DCPdelphiXE10.dproj ├── DCPdelphiXE10.res ├── DCPdelphiXE2.dpk ├── DCPdelphiXE2.dproj ├── DCPdelphiXE2.res ├── DCPdelphiXE3.dpk ├── DCPdelphiXE3.dproj ├── DCPdelphiXE3.res ├── DCPdelphiXE4.dpk ├── DCPdelphiXE4.dproj ├── DCPdelphiXE4.res ├── DCPdelphiXE5.dpk ├── DCPdelphiXE5.dproj ├── DCPdelphiXE5.res ├── DCPdelphiXE6.dpk ├── DCPdelphiXE6.dproj ├── DCPdelphiXE6.res ├── DCPdelphiXE7.dpk ├── DCPdelphiXE7.dproj ├── DCPdelphiXE7.res ├── DCPdelphiXE8.dpk ├── DCPdelphiXE8.dproj ├── DCPdelphiXE8.res ├── DCPhashes.dcr ├── DCPkylix.conf ├── DCPkylix.dpk ├── DCPkylix.kof ├── DCPkylix.res ├── DCPreg.pas ├── DCPtypes.pas ├── Demos ├── FileEncrypt │ ├── FileEncrypt.dpr │ ├── FileEncrypt.dproj │ ├── FileEncrypt.identcache │ ├── FileEncrypt.res │ ├── FileEncrypt_Icon.ico │ ├── uMain.dfm │ └── uMain.pas └── FileHash │ ├── FileHash.dpr │ ├── FileHash.dproj │ ├── FileHash.res │ ├── uMain.dfm │ └── uMain.pas ├── Docs ├── BlockCiphers.html ├── Ciphers.html ├── Hashes.html ├── Index.html ├── MIT_license.txt └── osi-certified-120x100.png ├── Hashes ├── DCPhaval.pas ├── DCPhaval3.inc ├── DCPhaval4.inc ├── DCPhaval5.inc ├── DCPmd4.pas ├── DCPmd5.pas ├── DCPripemd128.pas ├── DCPripemd160.pas ├── DCPsha1.pas ├── DCPsha256.pas ├── DCPsha512.pas ├── DCPtiger.inc └── DCPtiger.pas ├── README.md └── Readme.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.stat 2 | Win32 3 | Win64 4 | *.local 5 | -------------------------------------------------------------------------------- /Ciphers/DCPidea.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of IDEA *********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPidea; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | type 32 | TDCP_idea= class(TDCP_blockcipher64) 33 | protected 34 | EK, DK: array[0..51] of word; 35 | procedure InitKey(const Key; Size: longword); override; 36 | public 37 | class function GetID: integer; override; 38 | class function GetAlgorithm: string; override; 39 | class function GetMaxKeySize: integer; override; 40 | class function SelfTest: boolean; override; 41 | procedure Burn; override; 42 | procedure EncryptECB(const InData; var OutData); override; 43 | procedure DecryptECB(const InData; var OutData); override; 44 | end; 45 | 46 | 47 | {******************************************************************************} 48 | {******************************************************************************} 49 | implementation 50 | {$R-}{$Q-} 51 | 52 | class function TDCP_idea.GetMaxKeySize: integer; 53 | begin 54 | Result:= 128; 55 | end; 56 | 57 | class function TDCP_idea.GetID: integer; 58 | begin 59 | Result:= DCP_idea; 60 | end; 61 | 62 | class function TDCP_idea.GetAlgorithm: string; 63 | begin 64 | Result:= 'IDEA'; 65 | end; 66 | 67 | class function TDCP_idea.SelfTest: boolean; 68 | const 69 | Key1: array[0..15] of byte= 70 | ($3A,$98,$4E,$20,$00,$19,$5D,$B3,$2E,$E5,$01,$C8,$C4,$7C,$EA,$60); 71 | InData1: array[0..7] of byte= 72 | ($01,$02,$03,$04,$05,$06,$07,$08); 73 | OutData1: array[0..7] of byte= 74 | ($97,$BC,$D8,$20,$07,$80,$DA,$86); 75 | Key2: array[0..15] of byte= 76 | ($00,$64,$00,$C8,$01,$2C,$01,$90,$01,$F4,$02,$58,$02,$BC,$03,$20); 77 | InData2: array[0..7] of byte= 78 | ($05,$32,$0A,$64,$14,$C8,$19,$FA); 79 | OutData2: array[0..7] of byte= 80 | ($65,$BE,$87,$E7,$A2,$53,$8A,$ED); 81 | var 82 | Cipher: TDCP_idea; 83 | Data: array[0..7] of byte; 84 | begin 85 | Cipher:= TDCP_idea.Create(nil); 86 | Cipher.Init(Key1,Sizeof(Key1)*8,nil); 87 | Cipher.EncryptECB(InData1,Data); 88 | Result:= boolean(CompareMem(@Data,@OutData1,Sizeof(Data))); 89 | Cipher.DecryptECB(Data,Data); 90 | Result:= Result and boolean(CompareMem(@Data,@InData1,Sizeof(Data))); 91 | Cipher.Burn; 92 | Cipher.Init(Key2,Sizeof(Key2)*8,nil); 93 | Cipher.EncryptECB(InData2,Data); 94 | Result:= Result and boolean(CompareMem(@Data,@OutData2,Sizeof(Data))); 95 | Cipher.DecryptECB(Data,Data); 96 | Result:= Result and boolean(CompareMem(@Data,@InData2,Sizeof(Data))); 97 | Cipher.Burn; 98 | Cipher.Free; 99 | end; 100 | 101 | function MulInv(x: word): word; 102 | var 103 | t0, t1, q, y: word; 104 | begin 105 | if x<= 1 then 106 | begin 107 | Result:= x; 108 | Exit; 109 | end; 110 | t1:= DWord($10001) div x; 111 | y:= DWord($10001) mod x; 112 | if y= 1 then 113 | begin 114 | Result:= (1 - t1) and $FFFF; 115 | Exit; 116 | end; 117 | t0:= 1; 118 | repeat 119 | q:= x div y; 120 | x:= x mod y; 121 | t0:= t0 + (q*t1); 122 | if x= 1 then 123 | begin 124 | Result:= t0; 125 | Exit; 126 | end; 127 | q:= y div x; 128 | y:= y mod x; 129 | t1:= t1 + (q*t0); 130 | until y= 1; 131 | Result:= (1-t1) and $FFFF; 132 | end; 133 | 134 | procedure TDCP_idea.InitKey(const Key; Size: longword); 135 | var 136 | i: integer; 137 | begin 138 | Size:= Size div 8; 139 | 140 | FillChar(EK,Sizeof(EK),0); 141 | Move(Key,EK,Size); 142 | for i:= 0 to 7 do 143 | EK[i]:= (EK[i] shl 8) or (EK[i] shr 8); 144 | for i:= 1 to 5 do 145 | begin 146 | EK[(i*8)+0]:= (EK[((i-1)*8)+1] shl 9) or (EK[((i-1)*8)+2] shr 7); 147 | EK[(i*8)+1]:= (EK[((i-1)*8)+2] shl 9) or (EK[((i-1)*8)+3] shr 7); 148 | EK[(i*8)+2]:= (EK[((i-1)*8)+3] shl 9) or (EK[((i-1)*8)+4] shr 7); 149 | EK[(i*8)+3]:= (EK[((i-1)*8)+4] shl 9) or (EK[((i-1)*8)+5] shr 7); 150 | EK[(i*8)+4]:= (EK[((i-1)*8)+5] shl 9) or (EK[((i-1)*8)+6] shr 7); 151 | EK[(i*8)+5]:= (EK[((i-1)*8)+6] shl 9) or (EK[((i-1)*8)+7] shr 7); 152 | EK[(i*8)+6]:= (EK[((i-1)*8)+7] shl 9) or (EK[((i-1)*8)+0] shr 7); 153 | EK[(i*8)+7]:= (EK[((i-1)*8)+0] shl 9) or (EK[((i-1)*8)+1] shr 7); 154 | end; 155 | EK[48]:= (EK[41] shl 9) or (EK[42] shr 7); 156 | EK[49]:= (EK[42] shl 9) or (EK[43] shr 7); 157 | EK[50]:= (EK[43] shl 9) or (EK[44] shr 7); 158 | EK[51]:= (EK[44] shl 9) or (EK[45] shr 7); 159 | 160 | DK[51]:= MulInv(EK[3]); 161 | DK[50]:= -EK[2]; 162 | DK[49]:= -EK[1]; 163 | DK[48]:= MulInv(EK[0]); 164 | for i:= 0 to 6 do 165 | begin 166 | DK[47-i*6]:= EK[i*6+5]; 167 | DK[46-i*6]:= EK[i*6+4]; 168 | DK[45-i*6]:= MulInv(EK[i*6+9]); 169 | DK[44-i*6]:= -EK[i*6+7]; 170 | DK[43-i*6]:= -EK[i*6+8]; 171 | DK[42-i*6]:= MulInv(EK[i*6+6]); 172 | end; 173 | DK[5]:= EK[47]; 174 | DK[4]:= EK[46]; 175 | DK[3]:= MulInv(EK[51]); 176 | DK[2]:= -EK[50]; 177 | DK[1]:= -EK[49]; 178 | DK[0]:= MulInv(EK[48]); 179 | end; 180 | 181 | procedure TDCP_idea.Burn; 182 | begin 183 | FillChar(EK,Sizeof(EK),0); 184 | FillChar(DK,Sizeof(DK),0); 185 | inherited Burn; 186 | end; 187 | 188 | procedure Mul(var x: word; const y: word); 189 | var 190 | p: DWord; 191 | t16: word; 192 | begin 193 | p:= DWord(x)*y; 194 | if p= 0 then 195 | x:= 1 - x - y 196 | else 197 | begin 198 | x:= p shr 16; 199 | t16:= p and $FFFF; 200 | x:= t16 - x; 201 | if (t16 < x) then 202 | Inc(x); 203 | end; 204 | end; 205 | 206 | procedure TDCP_idea.EncryptECB(const InData; var OutData); 207 | var 208 | x: array[1..4] of word; 209 | s3, s2: word; 210 | i: longword; 211 | begin 212 | if not fInitialized then 213 | raise EDCP_blockcipher.Create('Cipher not initialized'); 214 | PDword(@X[1])^:= PDword(@InData)^; 215 | PDword(@X[3])^:= PDword(dword(@InData)+4)^; 216 | for i:= 1 to 4 do 217 | x[i]:= (x[i] shl 8) or (x[i] shr 8); 218 | for i:= 0 to 7 do 219 | begin 220 | Mul(x[1],EK[(i*6)+0]); 221 | Inc(x[2],EK[(i*6)+1]); 222 | Inc(x[3],EK[(i*6)+2]); 223 | Mul(x[4],EK[(i*6)+3]); 224 | s3:= x[3]; 225 | x[3]:= x[3] xor x[1]; 226 | Mul(x[3],EK[(i*6)+4]); 227 | s2:= x[2]; 228 | x[2]:= x[2] xor x[4]; 229 | Inc(x[2],x[3]); 230 | Mul(x[2],EK[(i*6)+5]); 231 | Inc(x[3],x[2]); 232 | x[1]:= x[1] xor x[2]; 233 | x[4]:= x[4] xor x[3]; 234 | x[2]:= x[2] xor s3; 235 | x[3]:= x[3] xor s2; 236 | end; 237 | Mul(x[1],EK[48]); 238 | Inc(x[3],EK[49]); 239 | Inc(x[2],EK[50]); 240 | Mul(x[4],EK[51]); 241 | x[1]:= (x[1] shl 8) or (x[1] shr 8); 242 | s2:= (x[3] shl 8) or (x[3] shr 8); 243 | x[3]:= (x[2] shl 8) or (x[2] shr 8); 244 | x[4]:= (x[4] shl 8) or (x[4] shr 8); 245 | x[2]:= s2; 246 | PDword(@OutData)^:= PDword(@x[1])^; 247 | PDword(dword(@OutData)+4)^:= PDword(@x[3])^; 248 | end; 249 | 250 | procedure TDCP_idea.DecryptECB(const InData; var OutData); 251 | var 252 | x: array[1..4] of word; 253 | s3, s2: word; 254 | i: longword; 255 | begin 256 | if not fInitialized then 257 | raise EDCP_blockcipher.Create('Cipher not initialized'); 258 | PDword(@X[1])^:= PDword(@InData)^; 259 | PDword(@X[3])^:= PDword(dword(@InData)+4)^; 260 | for i:= 1 to 4 do 261 | x[i]:= (x[i] shl 8) or (x[i] shr 8); 262 | for i:= 0 to 7 do 263 | begin 264 | Mul(x[1],DK[(i*6)+0]); 265 | Inc(x[2],DK[(i*6)+1]); 266 | Inc(x[3],DK[(i*6)+2]); 267 | Mul(x[4],DK[(i*6)+3]); 268 | s3:= x[3]; 269 | x[3]:= x[3] xor x[1]; 270 | Mul(x[3],DK[(i*6)+4]); 271 | s2:= x[2]; 272 | x[2]:= x[2] xor x[4]; 273 | Inc(x[2],x[3]); 274 | Mul(x[2],DK[(i*6)+5]); 275 | Inc(x[3],x[2]); 276 | x[1]:= x[1] xor x[2]; 277 | x[4]:= x[4] xor x[3]; 278 | x[2]:= x[2] xor s3; 279 | x[3]:= x[3] xor s2; 280 | end; 281 | Mul(x[1],DK[48]); 282 | Inc(x[3],DK[49]); 283 | Inc(x[2],DK[50]); 284 | Mul(x[4],DK[51]); 285 | x[1]:= (x[1] shl 8) or (x[1] shr 8); 286 | s2:= (x[3] shl 8) or (x[3] shr 8); 287 | x[3]:= (x[2] shl 8) or (x[2] shr 8); 288 | x[4]:= (x[4] shl 8) or (x[4] shr 8); 289 | x[2]:= s2; 290 | PDword(@OutData)^:= PDword(@x[1])^; 291 | PDword(dword(@OutData)+4)^:= PDword(@x[3])^; 292 | end; 293 | 294 | 295 | end. 296 | -------------------------------------------------------------------------------- /Ciphers/DCPmars.inc: -------------------------------------------------------------------------------- 1 | const 2 | S_Box: array[0..511] of DWord= ( 3 | $09d0c479, $28c8ffe0, $84aa6c39, $9dad7287, 4 | $7dff9be3, $d4268361, $c96da1d4, $7974cc93, 5 | $85d0582e, $2a4b5705, $1ca16a62, $c3bd279d, 6 | $0f1f25e5, $5160372f, $c695c1fb, $4d7ff1e4, 7 | $ae5f6bf4, $0d72ee46, $ff23de8a, $b1cf8e83, 8 | $f14902e2, $3e981e42, $8bf53eb6, $7f4bf8ac, 9 | $83631f83, $25970205, $76afe784, $3a7931d4, 10 | $4f846450, $5c64c3f6, $210a5f18, $c6986a26, 11 | $28f4e826, $3a60a81c, $d340a664, $7ea820c4, 12 | $526687c5, $7eddd12b, $32a11d1d, $9c9ef086, 13 | $80f6e831, $ab6f04ad, $56fb9b53, $8b2e095c, 14 | $b68556ae, $d2250b0d, $294a7721, $e21fb253, 15 | $ae136749, $e82aae86, $93365104, $99404a66, 16 | $78a784dc, $b69ba84b, $04046793, $23db5c1e, 17 | $46cae1d6, $2fe28134, $5a223942, $1863cd5b, 18 | $c190c6e3, $07dfb846, $6eb88816, $2d0dcc4a, 19 | $a4ccae59, $3798670d, $cbfa9493, $4f481d45, 20 | $eafc8ca8, $db1129d6, $b0449e20, $0f5407fb, 21 | $6167d9a8, $d1f45763, $4daa96c3, $3bec5958, 22 | $ababa014, $b6ccd201, $38d6279f, $02682215, 23 | $8f376cd5, $092c237e, $bfc56593, $32889d2c, 24 | $854b3e95, $05bb9b43, $7dcd5dcd, $a02e926c, 25 | $fae527e5, $36a1c330, $3412e1ae, $f257f462, 26 | $3c4f1d71, $30a2e809, $68e5f551, $9c61ba44, 27 | $5ded0ab8, $75ce09c8, $9654f93e, $698c0cca, 28 | $243cb3e4, $2b062b97, $0f3b8d9e, $00e050df, 29 | $fc5d6166, $e35f9288, $c079550d, $0591aee8, 30 | $8e531e74, $75fe3578, $2f6d829a, $f60b21ae, 31 | $95e8eb8d, $6699486b, $901d7d9b, $fd6d6e31, 32 | $1090acef, $e0670dd8, $dab2e692, $cd6d4365, 33 | $e5393514, $3af345f0, $6241fc4d, $460da3a3, 34 | $7bcf3729, $8bf1d1e0, $14aac070, $1587ed55, 35 | $3afd7d3e, $d2f29e01, $29a9d1f6, $efb10c53, 36 | $cf3b870f, $b414935c, $664465ed, $024acac7, 37 | $59a744c1, $1d2936a7, $dc580aa6, $cf574ca8, 38 | $040a7a10, $6cd81807, $8a98be4c, $accea063, 39 | $c33e92b5, $d1e0e03d, $b322517e, $2092bd13, 40 | $386b2c4a, $52e8dd58, $58656dfb, $50820371, 41 | $41811896, $e337ef7e, $d39fb119, $c97f0df6, 42 | $68fea01b, $a150a6e5, $55258962, $eb6ff41b, 43 | $d7c9cd7a, $a619cd9e, $bcf09576, $2672c073, 44 | $f003fb3c, $4ab7a50b, $1484126a, $487ba9b1, 45 | $a64fc9c6, $f6957d49, $38b06a75, $dd805fcd, 46 | $63d094cf, $f51c999e, $1aa4d343, $b8495294, 47 | $ce9f8e99, $bffcd770, $c7c275cc, $378453a7, 48 | $7b21be33, $397f41bd, $4e94d131, $92cc1f98, 49 | $5915ea51, $99f861b7, $c9980a88, $1d74fd5f, 50 | $b0a495f8, $614deed0, $b5778eea, $5941792d, 51 | $fa90c1f8, $33f824b4, $c4965372, $3ff6d550, 52 | $4ca5fec0, $8630e964, $5b3fbbd6, $7da26a48, 53 | $b203231a, $04297514, $2d639306, $2eb13149, 54 | $16a45272, $532459a0, $8e5f4872, $f966c7d9, 55 | $07128dc0, $0d44db62, $afc8d52d, $06316131, 56 | $d838e7ce, $1bc41d00, $3a2e8c0f, $ea83837e, 57 | $b984737d, $13ba4891, $c4f8b949, $a6d6acb3, 58 | $a215cdce, $8359838b, $6bd1aa31, $f579dd52, 59 | $21b93f93, $f5176781, $187dfdde, $e94aeb76, 60 | $2b38fd54, $431de1da, $ab394825, $9ad3048f, 61 | $dfea32aa, $659473e3, $623f7863, $f3346c59, 62 | $ab3ab685, $3346a90b, $6b56443e, $c6de01f8, 63 | $8d421fc0, $9b0ed10c, $88f1a1e9, $54c1f029, 64 | $7dead57b, $8d7ba426, $4cf5178a, $551a7cca, 65 | $1a9a5f08, $fcd651b9, $25605182, $e11fc6c3, 66 | $b6fd9676, $337b3027, $b7c8eb14, $9e5fd030, 67 | $6b57e354, $ad913cf7, $7e16688d, $58872a69, 68 | $2c2fc7df, $e389ccc6, $30738df1, $0824a734, 69 | $e1797a8b, $a4a8d57b, $5b5d193b, $c8a8309b, 70 | $73f9a978, $73398d32, $0f59573e, $e9df2b03, 71 | $e8a5b6c8, $848d0704, $98df93c2, $720a1dc3, 72 | $684f259a, $943ba848, $a6370152, $863b5ea3, 73 | $d17b978b, $6d9b58ef, $0a700dd4, $a73d36bf, 74 | $8e6a0829, $8695bc14, $e35b3447, $933ac568, 75 | $8894b022, $2f511c27, $ddfbcc3c, $006662b6, 76 | $117c83fe, $4e12b414, $c2bca766, $3a2fec10, 77 | $f4562420, $55792e2a, $46f5d857, $ceda25ce, 78 | $c3601d3b, $6c00ab46, $efac9c28, $b3c35047, 79 | $611dfee3, $257c3207, $fdd58482, $3b14d84f, 80 | $23becb64, $a075f3a3, $088f8ead, $07adf158, 81 | $7796943c, $facabf3d, $c09730cd, $f7679969, 82 | $da44e9ed, $2c854c12, $35935fa3, $2f057d9f, 83 | $690624f8, $1cb0bafd, $7b0dbdc6, $810f23bb, 84 | $fa929a1a, $6d969a17, $6742979b, $74ac7d05, 85 | $010e65c4, $86a3d963, $f907b5a0, $d0042bd3, 86 | $158d7d03, $287a8255, $bba8366f, $096edc33, 87 | $21916a7b, $77b56b86, $951622f9, $a6c5e650, 88 | $8cea17d1, $cd8c62bc, $a3d63433, $358a68fd, 89 | $0f9b9d3c, $d6aa295b, $fe33384a, $c000738e, 90 | $cd67eb2f, $e2eb6dc2, $97338b02, $06c9f246, 91 | $419cf1ad, $2b83c045, $3723f18a, $cb5b3089, 92 | $160bead7, $5d494656, $35f8a74b, $1e4e6c9e, 93 | $000399bd, $67466880, $b4174831, $acf423b2, 94 | $ca815ab3, $5a6395e7, $302a67c5, $8bdb446b, 95 | $108f8fa4, $10223eda, $92b8b48b, $7f38d0ee, 96 | $ab2701d4, $0262d415, $af224a30, $b3d88aba, 97 | $f8b2c3af, $daf7ef70, $cc97d3b7, $e9614b6c, 98 | $2baebff4, $70f687cf, $386c9156, $ce092ee5, 99 | $01e87da6, $6ce91e6a, $bb7bcc84, $c7922c20, 100 | $9d3b71fd, $060e41c6, $d7590f15, $4e03bb47, 101 | $183c198e, $63eeb240, $2ddbf49a, $6d5cba54, 102 | $923750af, $f9e14236, $7838162b, $59726c72, 103 | $81b66760, $bb2926c1, $48a0ce0d, $a6c0496d, 104 | $ad43507b, $718d496a, $9df057af, $44b1bde6, 105 | $054356dc, $de7ced35, $d51a138b, $62088cc9, 106 | $35830311, $c96efca2, $686f86ec, $8e77cb68, 107 | $63e1d6b8, $c80f9778, $79c491fd, $1b4c67f2, 108 | $72698d7d, $5e368c31, $f7d95e2e, $a1d3493f, 109 | $dcd9433e, $896f1552, $4bc4ca7a, $a6d1baf4, 110 | $a5a96dcc, $0bef8b46, $a169fda7, $74df40b7, 111 | $4e208804, $9a756607, $038e87c8, $20211e44, 112 | $8b7ad4bf, $c6403f35, $1848e36d, $80bdb038, 113 | $1e62891c, $643d2107, $bf04d6f8, $21092c8c, 114 | $f644f389, $0778404e, $7b78adb8, $a2c52d53, 115 | $42157abe, $a2253e2e, $7bf3f4ae, $80f594f9, 116 | $953194e7, $77eb92ed, $b3816930, $da8d9336, 117 | $bf447469, $f26d9483, $ee6faed5, $71371235, 118 | $de425f73, $b4e59f43, $7dbe2d4e, $2d37b185, 119 | $49dc9a63, $98c39d98, $1301c9a2, $389b1bbf, 120 | $0c18588d, $a421c1ba, $7aa3865c, $71e08558, 121 | $3c5cfcaa, $7d239ca4, $0297d9dd, $d7dc2830, 122 | $4b37802b, $7428ab54, $aeee0347, $4b3fbb85, 123 | $692f2f08, $134e578e, $36d9e0bf, $ae8b5fcf, 124 | $edb93ecf, $2b27248e, $170eb1ef, $7dc57fd6, 125 | $1e760f16, $b1136601, $864e1b9b, $d7ea7319, 126 | $3ab871bd, $cfa4d76f, $e31bd782, $0dbeb469, 127 | $abb96061, $5370f85d, $ffb07e37, $da30d0fb, 128 | $ebc977b6, $0b98b40f, $3a4d0fe6, $df4fc26b, 129 | $159cf22a, $c298d6e2, $2b78ef6a, $61a94ac0, 130 | $ab561187, $14eea0f0, $df0d4164, $19af70ee); 131 | 132 | vk: array[0..6] of DWord= ( 133 | $09d0c479, $28c8ffe0, $84aa6c39, $9dad7287, $7dff9be3, $d4268361, 134 | $c96da1d4); 135 | -------------------------------------------------------------------------------- /Ciphers/DCPmisty1.inc: -------------------------------------------------------------------------------- 1 | const 2 | S7TABLE: array[0..$7F] of byte= ( 3 | $1b, $32, $33, $5a, $3b, $10, $17, $54, $5b, $1a, $72, $73, $6b, $2c, $66, $49, 4 | $1f, $24, $13, $6c, $37, $2e, $3f, $4a, $5d, $0f, $40, $56, $25, $51, $1c, $04, 5 | $0b, $46, $20, $0d, $7b, $35, $44, $42, $2b, $1e, $41, $14, $4b, $79, $15, $6f, 6 | $0e, $55, $09, $36, $74, $0c, $67, $53, $28, $0a, $7e, $38, $02, $07, $60, $29, 7 | $19, $12, $65, $2f, $30, $39, $08, $68, $5f, $78, $2a, $4c, $64, $45, $75, $3d, 8 | $59, $48, $03, $57, $7c, $4f, $62, $3c, $1d, $21, $5e, $27, $6a, $70, $4d, $3a, 9 | $01, $6d, $6e, $63, $18, $77, $23, $05, $26, $76, $00, $31, $2d, $7a, $7f, $61, 10 | $50, $22, $11, $06, $47, $16, $52, $4e, $71, $3e, $69, $43, $34, $5c, $58, $7d); 11 | S9TABLE: array[0..$1FF] of Dword= ( 12 | $1c3, $0cb, $153, $19f, $1e3, $0e9, $0fb, $035, $181, $0b9, $117, $1eb, $133, $009, $02d, $0d3, 13 | $0c7, $14a, $037, $07e, $0eb, $164, $193, $1d8, $0a3, $11e, $055, $02c, $01d, $1a2, $163, $118, 14 | $14b, $152, $1d2, $00f, $02b, $030, $13a, $0e5, $111, $138, $18e, $063, $0e3, $0c8, $1f4, $01b, 15 | $001, $09d, $0f8, $1a0, $16d, $1f3, $01c, $146, $07d, $0d1, $082, $1ea, $183, $12d, $0f4, $19e, 16 | $1d3, $0dd, $1e2, $128, $1e0, $0ec, $059, $091, $011, $12f, $026, $0dc, $0b0, $18c, $10f, $1f7, 17 | $0e7, $16c, $0b6, $0f9, $0d8, $151, $101, $14c, $103, $0b8, $154, $12b, $1ae, $017, $071, $00c, 18 | $047, $058, $07f, $1a4, $134, $129, $084, $15d, $19d, $1b2, $1a3, $048, $07c, $051, $1ca, $023, 19 | $13d, $1a7, $165, $03b, $042, $0da, $192, $0ce, $0c1, $06b, $09f, $1f1, $12c, $184, $0fa, $196, 20 | $1e1, $169, $17d, $031, $180, $10a, $094, $1da, $186, $13e, $11c, $060, $175, $1cf, $067, $119, 21 | $065, $068, $099, $150, $008, $007, $17c, $0b7, $024, $019, $0de, $127, $0db, $0e4, $1a9, $052, 22 | $109, $090, $19c, $1c1, $028, $1b3, $135, $16a, $176, $0df, $1e5, $188, $0c5, $16e, $1de, $1b1, 23 | $0c3, $1df, $036, $0ee, $1ee, $0f0, $093, $049, $09a, $1b6, $069, $081, $125, $00b, $05e, $0b4, 24 | $149, $1c7, $174, $03e, $13b, $1b7, $08e, $1c6, $0ae, $010, $095, $1ef, $04e, $0f2, $1fd, $085, 25 | $0fd, $0f6, $0a0, $16f, $083, $08a, $156, $09b, $13c, $107, $167, $098, $1d0, $1e9, $003, $1fe, 26 | $0bd, $122, $089, $0d2, $18f, $012, $033, $06a, $142, $0ed, $170, $11b, $0e2, $14f, $158, $131, 27 | $147, $05d, $113, $1cd, $079, $161, $1a5, $179, $09e, $1b4, $0cc, $022, $132, $01a, $0e8, $004, 28 | $187, $1ed, $197, $039, $1bf, $1d7, $027, $18b, $0c6, $09c, $0d0, $14e, $06c, $034, $1f2, $06e, 29 | $0ca, $025, $0ba, $191, $0fe, $013, $106, $02f, $1ad, $172, $1db, $0c0, $10b, $1d6, $0f5, $1ec, 30 | $10d, $076, $114, $1ab, $075, $10c, $1e4, $159, $054, $11f, $04b, $0c4, $1be, $0f7, $029, $0a4, 31 | $00e, $1f0, $077, $04d, $17a, $086, $08b, $0b3, $171, $0bf, $10e, $104, $097, $15b, $160, $168, 32 | $0d7, $0bb, $066, $1ce, $0fc, $092, $1c5, $06f, $016, $04a, $0a1, $139, $0af, $0f1, $190, $00a, 33 | $1aa, $143, $17b, $056, $18d, $166, $0d4, $1fb, $14d, $194, $19a, $087, $1f8, $123, $0a7, $1b8, 34 | $141, $03c, $1f9, $140, $02a, $155, $11a, $1a1, $198, $0d5, $126, $1af, $061, $12e, $157, $1dc, 35 | $072, $18a, $0aa, $096, $115, $0ef, $045, $07b, $08d, $145, $053, $05f, $178, $0b2, $02e, $020, 36 | $1d5, $03f, $1c9, $1e7, $1ac, $044, $038, $014, $0b1, $16b, $0ab, $0b5, $05a, $182, $1c8, $1d4, 37 | $018, $177, $064, $0cf, $06d, $100, $199, $130, $15a, $005, $120, $1bb, $1bd, $0e0, $04f, $0d6, 38 | $13f, $1c4, $12a, $015, $006, $0ff, $19b, $0a6, $043, $088, $050, $15f, $1e8, $121, $073, $17e, 39 | $0bc, $0c2, $0c9, $173, $189, $1f5, $074, $1cc, $1e6, $1a8, $195, $01f, $041, $00d, $1ba, $032, 40 | $03d, $1d1, $080, $0a8, $057, $1b9, $162, $148, $0d9, $105, $062, $07a, $021, $1ff, $112, $108, 41 | $1c0, $0a9, $11d, $1b0, $1a6, $0cd, $0f3, $05c, $102, $05b, $1d9, $144, $1f6, $0ad, $0a5, $03a, 42 | $1cb, $136, $17f, $046, $0e1, $01e, $1dd, $0e6, $137, $1fa, $185, $08c, $08f, $040, $1b5, $0be, 43 | $078, $000, $0ac, $110, $15e, $124, $002, $1bc, $0a2, $0ea, $070, $1fc, $116, $15c, $04c, $1c2); 44 | -------------------------------------------------------------------------------- /Ciphers/DCPmisty1.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of Misty1 *******************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPmisty1; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | const 32 | NUMROUNDS= 8; 33 | 34 | type 35 | TDCP_misty1= class(TDCP_blockcipher64) 36 | protected 37 | KeyData: array[0..31] of DWord; 38 | function FI(const FI_IN, FI_KEY: DWord): DWord; 39 | function FO(const FO_IN: DWord; const k: longword): DWord; 40 | function FL(const FL_IN: DWord; const k: longword): DWord; 41 | function FLINV(const FL_IN: DWord; const k: longword): DWord; 42 | procedure InitKey(const Key; Size: longword); override; 43 | public 44 | class function GetID: integer; override; 45 | class function GetAlgorithm: string; override; 46 | class function GetMaxKeySize: integer; override; 47 | class function SelfTest: boolean; override; 48 | procedure Burn; override; 49 | procedure EncryptECB(const InData; var OutData); override; 50 | procedure DecryptECB(const InData; var OutData); override; 51 | end; 52 | 53 | 54 | {******************************************************************************} 55 | {******************************************************************************} 56 | implementation 57 | {$R-}{$Q-} 58 | 59 | {$I DCPmisty1.inc} 60 | 61 | function SwapDword(a: dword): dword; 62 | begin 63 | Result:= ((a and $FF) shl 24) or ((a and $FF00) shl 8) or ((a and $FF0000) shr 8) or ((a and $FF000000) shr 24); 64 | end; 65 | 66 | class function TDCP_misty1.GetID: integer; 67 | begin 68 | Result:= DCP_misty1; 69 | end; 70 | 71 | class function TDCP_misty1.GetAlgorithm: string; 72 | begin 73 | Result:= 'Misty1'; 74 | end; 75 | 76 | class function TDCP_misty1.GetMaxKeySize: integer; 77 | begin 78 | Result:= 128; 79 | end; 80 | 81 | class function TDCP_misty1.SelfTest: boolean; 82 | const 83 | Key: array[0..15] of byte= 84 | ($00,$11,$22,$33,$44,$55,$66,$77,$88,$99,$aa,$bb,$cc,$dd,$ee,$ff); 85 | Plain1: array[0..7] of byte= ($01,$23,$45,$67,$89,$ab,$cd,$ef); 86 | Plain2: array[0..7] of byte= ($fe,$dc,$ba,$98,$76,$54,$32,$10); 87 | Cipher1: array[0..7] of byte= ($8b,$1d,$a5,$f5,$6a,$b3,$d0,$7c); 88 | Cipher2: array[0..7] of byte= ($04,$b6,$82,$40,$b1,$3b,$e9,$5d); 89 | var 90 | Cipher: TDCP_misty1; 91 | Block: array[0..7] of byte; 92 | begin 93 | Cipher:= TDCP_misty1.Create(nil); 94 | Cipher.Init(Key,Sizeof(Key)*8,nil); 95 | Cipher.EncryptECB(Plain1,Block); 96 | Result:= CompareMem(@Cipher1,@Block,Sizeof(Block)); 97 | Cipher.DecryptECB(Block,Block); 98 | Result:= Result and CompareMem(@Plain1,@Block,Sizeof(Block)); 99 | Cipher.EncryptECB(Plain2,Block); 100 | Result:= Result and CompareMem(@Cipher2,@Block,Sizeof(Block)); 101 | Cipher.DecryptECB(Block,Block); 102 | Result:= Result and CompareMem(@Plain2,@Block,Sizeof(Block)); 103 | Cipher.Burn; 104 | Cipher.Free; 105 | end; 106 | 107 | function TDCP_misty1.FI(const FI_IN, FI_KEY: DWord): DWord; 108 | var 109 | d7, d9: DWord; 110 | begin 111 | d9:= (FI_IN shr 7) and $1ff; 112 | d7:= FI_IN and $7f; 113 | d9:= S9Table[d9] xor d7; 114 | d7:= (S7Table[d7] xor d9) and $7f; 115 | d7:= d7 xor ((FI_KEY shr 9) and $7f); 116 | d9:= d9 xor (FI_KEY and $1ff); 117 | d9:= S9Table[d9] xor d7; 118 | Result:= (d7 shl 9) or d9; 119 | end; 120 | 121 | function TDCP_misty1.FO(const FO_IN: DWord; const k: longword): DWord; 122 | var 123 | t0, t1: DWord; 124 | begin 125 | t0:= FO_IN shr 16; 126 | t1:= FO_IN and $FFFF; 127 | t0:= t0 xor KeyData[k]; 128 | t0:= FI(t0,KeyData[((k+5) mod 8) + 8]); 129 | t0:= t0 xor t1; 130 | t1:= t1 xor KeyData[(k+2) mod 8]; 131 | t1:= FI(t1,KeyData[((k+1) mod 8) + 8]); 132 | t1:= t1 xor t0; 133 | t0:= t0 xor KeyData[(k+7) mod 8]; 134 | t0:= FI(t0,KeyData[((k+3) mod 8) + 8]); 135 | t0:= t0 xor t1; 136 | t1:= t1 xor KeyData[(k+4) mod 8]; 137 | Result:= (t1 shl 16) or t0; 138 | end; 139 | 140 | function TDCP_misty1.FL(const FL_IN: DWord; const k: longword): DWord; 141 | var 142 | d0, d1: DWord; 143 | t: byte; 144 | begin 145 | d0:= FL_IN shr 16; 146 | d1:= FL_IN and $FFFF; 147 | if (k mod 2)<> 0 then 148 | begin 149 | t:= (k-1) div 2; 150 | d1:= d1 xor (d0 and KeyData[((t + 2) mod 8) + 8]); 151 | d0:= d0 xor (d1 or KeyData[(t + 4) mod 8]); 152 | end 153 | else 154 | begin 155 | t:= k div 2; 156 | d1:= d1 xor (d0 and KeyData[t]); 157 | d0:= d0 xor (d1 or KeyData[((t+6) mod 8) + 8]); 158 | end; 159 | Result:= (d0 shl 16) or d1; 160 | end; 161 | 162 | function TDCP_misty1.FLINV(const FL_IN: DWord; const k: longword): DWord; 163 | var 164 | d0, d1: DWord; 165 | t: byte; 166 | begin 167 | d0:= FL_IN shr 16; 168 | d1:= FL_IN and $FFFF; 169 | if (k mod 2)<> 0 then 170 | begin 171 | t:= (k-1) div 2; 172 | d0:= d0 xor (d1 or KeyData[(t+4) mod 8]); 173 | d1:= d1 xor (d0 and KeyData[((t+2) mod 8) + 8]); 174 | end 175 | else 176 | begin 177 | t:= k div 2; 178 | d0:= d0 xor (d1 or KeyData[((t+6) mod 8) + 8]); 179 | d1:= d1 xor (d0 and KeyData[t]); 180 | end; 181 | Result:= (d0 shl 16) or d1; 182 | end; 183 | 184 | procedure TDCP_misty1.InitKey(const Key; Size: longword); 185 | var 186 | KeyB: array[0..15] of byte; 187 | i: longword; 188 | begin 189 | FillChar(KeyB,Sizeof(KeyB),0); 190 | Move(Key,KeyB,Size div 8); 191 | for i:= 0 to 7 do 192 | KeyData[i]:= (KeyB[i*2] * 256) + KeyB[i*2+1]; 193 | for i:= 0 to 7 do 194 | begin 195 | KeyData[i+8]:= FI(KeyData[i],KeyData[(i+1) mod 8]); 196 | KeyData[i+16]:= KeyData[i+8] and $1FF; 197 | KeyData[i+24]:= KeyData[i+8] shr 9; 198 | end; 199 | end; 200 | 201 | procedure TDCP_misty1.Burn; 202 | begin 203 | FillChar(KeyData,Sizeof(KeyData),0); 204 | inherited Burn; 205 | end; 206 | 207 | procedure TDCP_misty1.EncryptECB(const InData; var OutData); 208 | var 209 | d0, d1: DWord; 210 | i: longword; 211 | begin 212 | if not fInitialized then 213 | raise EDCP_blockcipher.Create('Cipher not initialized'); 214 | d0:= SwapDWord(PDWord(@InData)^); 215 | d1:= SwapDWord(PDWord(longword(@InData)+4)^); 216 | for i:= 0 to NUMROUNDS-1 do 217 | begin 218 | if (i mod 2)= 0 then 219 | begin 220 | d0:= FL(D0,i); 221 | d1:= FL(D1,i+1); 222 | d1:= d1 xor FO(d0,i); 223 | end 224 | else 225 | d0:= d0 xor FO(d1,i); 226 | end; 227 | d0:= FL(d0,NUMROUNDS); 228 | d1:= FL(d1,NUMROUNDS+1); 229 | PDWord(@OutData)^:= SwapDWord(d1); 230 | PDWord(longword(@OutData)+4)^:= SwapDWord(d0); 231 | end; 232 | 233 | procedure TDCP_misty1.DecryptECB(const InData; var OutData); 234 | var 235 | d0, d1: DWord; 236 | i: longword; 237 | begin 238 | if not fInitialized then 239 | raise EDCP_blockcipher.Create('Cipher not initialized'); 240 | d1:= SwapDWord(PDWord(@InData)^); 241 | d0:= SwapDWord(PDWord(longword(@InData)+4)^); 242 | d1:= FLINV(d1,NUMROUNDS+1); 243 | d0:= FLINV(d0,NUMROUNDS); 244 | for i:= NUMROUNDS-1 downto 0 do 245 | begin 246 | if (i mod 2)= 0 then 247 | begin 248 | d1:= d1 xor FO(d0,i); 249 | d0:= FLINV(D0,i); 250 | d1:= FLINV(D1,i+1); 251 | end 252 | else 253 | d0:= d0 xor FO(d1,i); 254 | end; 255 | PDWord(@OutData)^:= SwapDWord(d0); 256 | PDWord(longword(@OutData)+4)^:= SwapDWord(d1); 257 | end; 258 | 259 | end. 260 | -------------------------------------------------------------------------------- /Ciphers/DCPrc2.inc: -------------------------------------------------------------------------------- 1 | const 2 | sBox: array[0..255] of byte= ( 3 | $D9,$78,$F9,$C4,$19,$DD,$B5,$ED,$28,$E9,$FD,$79,$4A,$A0,$D8,$9D, 4 | $C6,$7E,$37,$83,$2B,$76,$53,$8E,$62,$4C,$64,$88,$44,$8B,$FB,$A2, 5 | $17,$9A,$59,$F5,$87,$B3,$4F,$13,$61,$45,$6D,$8D,$09,$81,$7D,$32, 6 | $BD,$8F,$40,$EB,$86,$B7,$7B,$0B,$F0,$95,$21,$22,$5C,$6B,$4E,$82, 7 | $54,$D6,$65,$93,$CE,$60,$B2,$1C,$73,$56,$C0,$14,$A7,$8C,$F1,$DC, 8 | $12,$75,$CA,$1F,$3B,$BE,$E4,$D1,$42,$3D,$D4,$30,$A3,$3C,$B6,$26, 9 | $6F,$BF,$0E,$DA,$46,$69,$07,$57,$27,$F2,$1D,$9B,$BC,$94,$43,$03, 10 | $F8,$11,$C7,$F6,$90,$EF,$3E,$E7,$06,$C3,$D5,$2F,$C8,$66,$1E,$D7, 11 | $08,$E8,$EA,$DE,$80,$52,$EE,$F7,$84,$AA,$72,$AC,$35,$4D,$6A,$2A, 12 | $96,$1A,$D2,$71,$5A,$15,$49,$74,$4B,$9F,$D0,$5E,$04,$18,$A4,$EC, 13 | $C2,$E0,$41,$6E,$0F,$51,$CB,$CC,$24,$91,$AF,$50,$A1,$F4,$70,$39, 14 | $99,$7C,$3A,$85,$23,$B8,$B4,$7A,$FC,$02,$36,$5B,$25,$55,$97,$31, 15 | $2D,$5D,$FA,$98,$E3,$8A,$92,$AE,$05,$DF,$29,$10,$67,$6C,$BA,$C9, 16 | $D3,$00,$E6,$CF,$E1,$9E,$A8,$2C,$63,$16,$01,$3F,$58,$E2,$89,$A9, 17 | $0D,$38,$34,$1B,$AB,$33,$FF,$B0,$BB,$48,$0C,$5F,$B9,$B1,$CD,$2E, 18 | $C5,$F3,$DB,$47,$E5,$A5,$9C,$77,$0A,$A6,$20,$68,$FE,$7F,$C1,$AD); 19 | -------------------------------------------------------------------------------- /Ciphers/DCPrc2.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of RC2 **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPrc2; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | type 32 | TDCP_rc2= class(TDCP_blockcipher64) 33 | protected 34 | KeyData: array[0..63] of word; 35 | procedure InitKey(const Key; Size: longword); override; 36 | public 37 | class function GetID: integer; override; 38 | class function GetAlgorithm: string; override; 39 | class function GetMaxKeySize: integer; override; 40 | class function SelfTest: boolean; override; 41 | procedure Burn; override; 42 | procedure EncryptECB(const InData; var OutData); override; 43 | procedure DecryptECB(const InData; var OutData); override; 44 | end; 45 | 46 | 47 | {******************************************************************************} 48 | {******************************************************************************} 49 | implementation 50 | {$R-}{$Q-} 51 | 52 | {$I DCPrc2.inc} 53 | 54 | function LRot16(a, n: word): word; 55 | begin 56 | Result:= (a shl n) or (a shr (16-n)); 57 | end; 58 | 59 | function RRot16(a, n: word): word; 60 | begin 61 | Result:= (a shr n) or (a shl (16-n)); 62 | end; 63 | 64 | class function TDCP_rc2.GetMaxKeySize: integer; 65 | begin 66 | Result:= 1024; 67 | end; 68 | 69 | class function TDCP_rc2.GetID: integer; 70 | begin 71 | Result:= DCP_rc2; 72 | end; 73 | 74 | class function TDCP_rc2.GetAlgorithm: string; 75 | begin 76 | Result:= 'RC2'; 77 | end; 78 | 79 | class function TDCP_rc2.SelfTest: boolean; 80 | const 81 | Key1: array[0..15] of byte= 82 | ($00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F); 83 | InData1: array[0..7] of byte= 84 | ($00,$00,$00,$00,$00,$00,$00,$00); 85 | OutData1: array[0..7] of byte= 86 | ($50,$DC,$01,$62,$BD,$75,$7F,$31); 87 | Key2: array[0..15] of byte= 88 | ($00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01); 89 | InData2: array[0..7] of byte= 90 | ($00,$00,$00,$00,$00,$00,$00,$00); 91 | OutData2: array[0..7] of byte= 92 | ($21,$82,$9C,$78,$A9,$F9,$C0,$74); 93 | var 94 | Cipher: TDCP_rc2; 95 | Data: array[0..7] of byte; 96 | begin 97 | Cipher:= TDCP_rc2.Create(nil); 98 | Cipher.Init(Key1,Sizeof(Key1)*8,nil); 99 | Cipher.EncryptECB(InData1,Data); 100 | Result:= boolean(CompareMem(@Data,@OutData1,Sizeof(Data))); 101 | Cipher.DecryptECB(Data,Data); 102 | Result:= boolean(CompareMem(@Data,@InData1,Sizeof(Data))) and Result; 103 | Cipher.Burn; 104 | Cipher.Init(Key2,Sizeof(Key2)*8,nil); 105 | Cipher.EncryptECB(InData2,Data); 106 | Result:= boolean(CompareMem(@Data,@OutData2,Sizeof(Data))) and Result; 107 | Cipher.DecryptECB(Data,Data); 108 | Result:= boolean(CompareMem(@Data,@InData2,Sizeof(Data))) and Result; 109 | Cipher.Burn; 110 | Cipher.Free; 111 | end; 112 | 113 | procedure TDCP_rc2.InitKey(const Key; Size: longword); 114 | var 115 | i: longword; 116 | KeyB: array[0..127] of byte; 117 | begin 118 | Move(Key,KeyB,Size div 8); 119 | for i:= (Size div 8) to 127 do 120 | KeyB[i]:= sBox[(KeyB[i-(Size div 8)]+KeyB[i-1]) and $FF]; 121 | KeyB[0]:= sBox[KeyB[0]]; 122 | Move(KeyB,KeyData,Sizeof(KeyData)); 123 | end; 124 | 125 | procedure TDCP_rc2.Burn; 126 | begin 127 | FillChar(KeyData,Sizeof(KeyData),0); 128 | inherited Burn; 129 | end; 130 | 131 | procedure TDCP_rc2.EncryptECB(const InData; var OutData); 132 | var 133 | i, j: longword; 134 | w: array[0..3] of word; 135 | begin 136 | if not fInitialized then 137 | raise EDCP_blockcipher.Create('Cipher not initialized'); 138 | Pdword(@w[0])^:= Pdword(@InData)^; 139 | Pdword(@w[2])^:= Pdword(longword(@InData)+4)^; 140 | for i:= 0 to 15 do 141 | begin 142 | j:= i*4; 143 | w[0]:= LRot16((w[0]+(w[1] and (not w[3]))+(w[2] and w[3])+KeyData[j+0]),1); 144 | w[1]:= LRot16((w[1]+(w[2] and (not w[0]))+(w[3] and w[0])+KeyData[j+1]),2); 145 | w[2]:= LRot16((w[2]+(w[3] and (not w[1]))+(w[0] and w[1])+KeyData[j+2]),3); 146 | w[3]:= LRot16((w[3]+(w[0] and (not w[2]))+(w[1] and w[2])+KeyData[j+3]),5); 147 | if (i= 4) or (i= 10) then 148 | begin 149 | w[0]:= w[0]+KeyData[w[3] and 63]; 150 | w[1]:= w[1]+KeyData[w[0] and 63]; 151 | w[2]:= w[2]+KeyData[w[1] and 63]; 152 | w[3]:= w[3]+KeyData[w[2] and 63]; 153 | end; 154 | end; 155 | Pdword(@OutData)^:= Pdword(@w[0])^; 156 | Pdword(longword(@OutData)+4)^:= Pdword(@w[2])^; 157 | end; 158 | 159 | procedure TDCP_rc2.DecryptECB(const InData; var OutData); 160 | var 161 | i, j: longword; 162 | w: array[0..3] of word; 163 | begin 164 | if not fInitialized then 165 | raise EDCP_blockcipher.Create('Cipher not initialized'); 166 | Pdword(@w[0])^:= Pdword(@InData)^; 167 | Pdword(@w[2])^:= Pdword(longword(@InData)+4)^; 168 | for i:= 15 downto 0 do 169 | begin 170 | j:= i*4; 171 | w[3]:= RRot16(w[3],5)-(w[0] and (not w[2]))-(w[1] and w[2])-KeyData[j+3]; 172 | w[2]:= RRot16(w[2],3)-(w[3] and (not w[1]))-(w[0] and w[1])-KeyData[j+2]; 173 | w[1]:= RRot16(w[1],2)-(w[2] and (not w[0]))-(w[3] and w[0])-KeyData[j+1]; 174 | w[0]:= RRot16(w[0],1)-(w[1] and (not w[3]))-(w[2] and w[3])-KeyData[j+0]; 175 | if (i= 5) or (i= 11) then 176 | begin 177 | w[3]:= w[3]-KeyData[w[2] and 63]; 178 | w[2]:= w[2]-KeyData[w[1] and 63]; 179 | w[1]:= w[1]-KeyData[w[0] and 63]; 180 | w[0]:= w[0]-KeyData[w[3] and 63]; 181 | end; 182 | end; 183 | Pdword(@OutData)^:= Pdword(@w[0])^; 184 | Pdword(longword(@OutData)+4)^:= Pdword(@w[2])^; 185 | end; 186 | 187 | end. 188 | -------------------------------------------------------------------------------- /Ciphers/DCPrc4.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of RC4 **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPrc4; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst; 30 | 31 | type 32 | TDCP_rc4= class(TDCP_cipher) 33 | protected 34 | KeyData, KeyOrg: array[0..255] of byte; 35 | public 36 | class function GetID: integer; override; 37 | class function GetAlgorithm: string; override; 38 | class function GetMaxKeySize: integer; override; 39 | class function SelfTest: boolean; override; 40 | procedure Init(const Key; Size: longword; InitVector: pointer); override; 41 | procedure Reset; override; 42 | procedure Burn; override; 43 | procedure Encrypt(const InData; var OutData; Size: longword); override; 44 | procedure Decrypt(const InData; var OutData; Size: longword); override; 45 | end; 46 | 47 | {******************************************************************************} 48 | {******************************************************************************} 49 | implementation 50 | {$R-}{$Q-} 51 | 52 | class function TDCP_rc4.GetID: integer; 53 | begin 54 | Result:= DCP_rc4; 55 | end; 56 | 57 | class function TDCP_rc4.GetAlgorithm: string; 58 | begin 59 | Result:= 'RC4'; 60 | end; 61 | 62 | class function TDCP_rc4.GetMaxKeySize: integer; 63 | begin 64 | Result:= 2048; 65 | end; 66 | 67 | class function TDCP_rc4.SelfTest: boolean; 68 | const 69 | Key1: array[0..4] of byte= ($61,$8A,$63,$D2,$FB); 70 | InData1: array[0..4] of byte= ($DC,$EE,$4C,$F9,$2C); 71 | OutData1: array[0..4] of byte= ($F1,$38,$29,$C9,$DE); 72 | var 73 | Cipher: TDCP_rc4; 74 | Data: array[0..4] of byte; 75 | begin 76 | Cipher:= TDCP_rc4.Create(nil); 77 | Cipher.Init(Key1,Sizeof(Key1)*8,nil); 78 | Cipher.Encrypt(InData1,Data,Sizeof(Data)); 79 | Result:= boolean(CompareMem(@Data,@OutData1,Sizeof(Data))); 80 | Cipher.Reset; 81 | Cipher.Decrypt(Data,Data,Sizeof(Data)); 82 | Result:= boolean(CompareMem(@Data,@InData1,Sizeof(Data))) and Result; 83 | Cipher.Burn; 84 | Cipher.Free; 85 | end; 86 | 87 | procedure TDCP_rc4.Init(const Key; Size: longword; InitVector: pointer); 88 | var 89 | i, j, t: longword; 90 | xKey: array[0..255] of byte; 91 | begin 92 | if fInitialized then 93 | Burn; 94 | inherited Init(Key,Size,nil); 95 | Size:= Size div 8; 96 | i:= 0; 97 | while i< 255 do 98 | begin 99 | KeyData[i]:= i; 100 | xKey[i]:= PByte(longword(@Key)+(i mod Size))^; 101 | KeyData[i+1]:= i+1; 102 | xKey[i+1]:= PByte(longword(@Key)+((i+1) mod Size))^; 103 | KeyData[i+2]:= i+2; 104 | xKey[i+2]:= PByte(longword(@Key)+((i+2) mod Size))^; 105 | KeyData[i+3]:= i+3; 106 | xKey[i+3]:= PByte(longword(@Key)+((i+3) mod Size))^; 107 | KeyData[i+4]:= i+4; 108 | xKey[i+4]:= PByte(longword(@Key)+((i+4) mod Size))^; 109 | KeyData[i+5]:= i+5; 110 | xKey[i+5]:= PByte(longword(@Key)+((i+5) mod Size))^; 111 | KeyData[i+6]:= i+6; 112 | xKey[i+6]:= PByte(longword(@Key)+((i+6) mod Size))^; 113 | KeyData[i+7]:= i+7; 114 | xKey[i+7]:= PByte(longword(@Key)+((i+7) mod Size))^; 115 | Inc(i,8); 116 | end; 117 | j:= 0; 118 | i:= 0; 119 | while i< 255 do 120 | begin 121 | j:= (j+KeyData[i]+xKey[i]) and $FF; 122 | t:= KeyData[i]; 123 | KeyData[i]:= KeyData[j]; 124 | KeyData[j]:= t; 125 | j:= (j+KeyData[i+1]+xKey[i+1]) and $FF; 126 | t:= KeyData[i+1]; 127 | KeyData[i+1]:= KeyData[j]; 128 | KeyData[j]:= t; 129 | j:= (j+KeyData[i+2]+xKey[i+2]) and $FF; 130 | t:= KeyData[i+2]; 131 | KeyData[i+2]:= KeyData[j]; 132 | KeyData[j]:= t; 133 | j:= (j+KeyData[i+3]+xKey[i+3]) and $FF; 134 | t:= KeyData[i+3]; 135 | KeyData[i+3]:= KeyData[j]; 136 | KeyData[j]:= t; 137 | j:= (j+KeyData[i+4]+xKey[i+4]) and $FF; 138 | t:= KeyData[i+4]; 139 | KeyData[i+4]:= KeyData[j]; 140 | KeyData[j]:= t; 141 | j:= (j+KeyData[i+5]+xKey[i+5]) and $FF; 142 | t:= KeyData[i+5]; 143 | KeyData[i+5]:= KeyData[j]; 144 | KeyData[j]:= t; 145 | j:= (j+KeyData[i+6]+xKey[i+6]) and $FF; 146 | t:= KeyData[i+6]; 147 | KeyData[i+6]:= KeyData[j]; 148 | KeyData[j]:= t; 149 | j:= (j+KeyData[i+7]+xKey[i+7]) and $FF; 150 | t:= KeyData[i+7]; 151 | KeyData[i+7]:= KeyData[j]; 152 | KeyData[j]:= t; 153 | Inc(i,8); 154 | end; 155 | Move(KeyData,KeyOrg,Sizeof(KeyOrg)); 156 | end; 157 | 158 | procedure TDCP_rc4.Reset; 159 | begin 160 | Move(KeyOrg,KeyData,Sizeof(KeyData)); 161 | end; 162 | 163 | procedure TDCP_rc4.Burn; 164 | begin 165 | FillChar(KeyOrg,Sizeof(KeyOrg),$FF); 166 | FillChar(KeyData,Sizeof(KeyData),$FF); 167 | inherited Burn; 168 | end; 169 | 170 | procedure TDCP_rc4.Encrypt(const InData; var OutData; Size: longword); 171 | var 172 | i, j, t, k: longword; 173 | begin 174 | if not fInitialized then 175 | raise EDCP_cipher.Create('Cipher not initialized'); 176 | i:= 0; j:= 0; 177 | for k:= 0 to Size-1 do 178 | begin 179 | i:= (i + 1) and $FF; 180 | t:= KeyData[i]; 181 | j:= (j + t) and $FF; 182 | KeyData[i]:= KeyData[j]; 183 | KeyData[j]:= t; 184 | t:= (t + KeyData[i]) and $FF; 185 | Pbytearray(@OutData)^[k]:= Pbytearray(@InData)^[k] xor KeyData[t]; 186 | end; 187 | end; 188 | 189 | procedure TDCP_rc4.Decrypt(const InData; var OutData; Size: longword); 190 | var 191 | i, j, t, k: longword; 192 | begin 193 | if not fInitialized then 194 | raise EDCP_cipher.Create('Cipher not initialized'); 195 | i:= 0; j:= 0; 196 | for k:= 0 to Size-1 do 197 | begin 198 | i:= (i + 1) and $FF; 199 | t:= KeyData[i]; 200 | j:= (j + t) and $FF; 201 | KeyData[i]:= KeyData[j]; 202 | KeyData[j]:= t; 203 | t:= (t + KeyData[i]) and $FF; 204 | Pbytearray(@OutData)^[k]:= Pbytearray(@InData)^[k] xor KeyData[t]; 205 | end; 206 | end; 207 | 208 | 209 | end. 210 | -------------------------------------------------------------------------------- /Ciphers/DCPrc5.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of RC5 **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPrc5; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | const 32 | NUMROUNDS= 12; { number of rounds must be between 12-16 } 33 | 34 | type 35 | TDCP_rc5= class(TDCP_blockcipher64) 36 | protected 37 | KeyData: array[0..((NUMROUNDS*2)+1)] of DWord; 38 | procedure InitKey(const Key; Size: longword); override; 39 | public 40 | class function GetId: integer; override; 41 | class function GetAlgorithm: string; override; 42 | class function GetMaxKeySize: integer; override; 43 | class function SelfTest: boolean; override; 44 | procedure Burn; override; 45 | procedure EncryptECB(const InData; var OutData); override; 46 | procedure DecryptECB(const InData; var OutData); override; 47 | end; 48 | 49 | 50 | {******************************************************************************} 51 | {******************************************************************************} 52 | implementation 53 | {$R-}{$Q-} 54 | 55 | const 56 | sBox: array[0..33] of dword= ( 57 | $B7E15163,$5618CB1C,$F45044D5,$9287BE8E,$30BF3847,$CEF6B200, 58 | $6D2E2BB9,$0B65A572,$A99D1F2B,$47D498E4,$E60C129D,$84438C56, 59 | $227B060F,$C0B27FC8,$5EE9F981,$FD21733A,$9B58ECF3,$399066AC, 60 | $D7C7E065,$75FF5A1E,$1436D3D7,$B26E4D90,$50A5C749,$EEDD4102, 61 | $8D14BABB,$2B4C3474,$C983AE2D,$67BB27E6,$05F2A19F,$A42A1B58, 62 | $42619511,$E0990ECA,$7ED08883,$1D08023C); 63 | 64 | function LRot32(a, b: longword): longword; 65 | begin 66 | Result:= (a shl b) or (a shr (32-b)); 67 | end; 68 | 69 | function RRot32(a, b: longword): longword; 70 | begin 71 | Result:= (a shr b) or (a shl (32-b)); 72 | end; 73 | 74 | class function TDCP_rc5.GetID: integer; 75 | begin 76 | Result:= DCP_rc5; 77 | end; 78 | 79 | class function TDCP_rc5.GetAlgorithm: string; 80 | begin 81 | Result:= 'RC5'; 82 | end; 83 | 84 | class function TDCP_rc5.GetMaxKeySize: integer; 85 | begin 86 | Result:= 2048; 87 | end; 88 | 89 | class function TDCP_rc5.SelfTest: boolean; 90 | const 91 | Key1: array[0..15] of byte= 92 | ($DC,$49,$DB,$13,$75,$A5,$58,$4F,$64,$85,$B4,$13,$B5,$F1,$2B,$AF); 93 | Plain1: array[0..1] of dword= 94 | ($B7B3422F,$92FC6903); 95 | Cipher1: array[0..1] of dword= 96 | ($B278C165,$CC97D184); 97 | Key2: array[0..15] of byte= 98 | ($52,$69,$F1,$49,$D4,$1B,$A0,$15,$24,$97,$57,$4D,$7F,$15,$31,$25); 99 | Plain2: array[0..1] of dword= 100 | ($B278C165,$CC97D184); 101 | Cipher2: array[0..1] of dword= 102 | ($15E444EB,$249831DA); 103 | var 104 | Cipher: TDCP_rc5; 105 | Data: array[0..1] of dword; 106 | begin 107 | Cipher:= TDCP_rc5.Create(nil); 108 | Cipher.Init(Key1,Sizeof(Key1)*8,nil); 109 | Cipher.EncryptECB(Plain1,Data); 110 | Result:= boolean(CompareMem(@Data,@Cipher1,Sizeof(Data))); 111 | Cipher.DecryptECB(Data,Data); 112 | Result:= Result and boolean(CompareMem(@Data,@Plain1,Sizeof(Data))); 113 | Cipher.Burn; 114 | Cipher.Init(Key2,Sizeof(Key2)*8,nil); 115 | Cipher.EncryptECB(Plain2,Data); 116 | Result:= Result and boolean(CompareMem(@Data,@Cipher2,Sizeof(Data))); 117 | Cipher.DecryptECB(Data,Data); 118 | Result:= Result and boolean(CompareMem(@Data,@Plain2,Sizeof(Data))); 119 | Cipher.Burn; 120 | Cipher.Free; 121 | end; 122 | 123 | procedure TDCP_rc5.InitKey(const Key; Size: longword); 124 | var 125 | xKeyD: array[0..63] of DWord; 126 | i, j, k, xKeyLen: longword; 127 | A, B: DWord; 128 | begin 129 | FillChar(xKeyD,Sizeof(xKeyD),0); 130 | Size:= Size div 8; 131 | Move(Key,xKeyD,Size); 132 | xKeyLen:= Size div 4; 133 | if (Size mod 4)<> 0 then 134 | Inc(xKeyLen); 135 | Move(sBox,KeyData,(NUMROUNDS+1)*8); 136 | i:= 0; j:= 0; 137 | A:= 0; B:= 0; 138 | if xKeyLen> ((NUMROUNDS+1)*2) then 139 | k:= xKeyLen*3 140 | else 141 | k:= (NUMROUNDS+1)*6; 142 | for k:= k downto 1 do 143 | begin 144 | A:= LRot32(KeyData[i]+A+B,3); 145 | KeyData[i]:= A; 146 | B:= LRot32(xKeyD[j]+A+B,A+B); 147 | xKeyD[j]:= B; 148 | i:= (i+1) mod ((NUMROUNDS+1)*2); 149 | j:= (j+1) mod xKeyLen; 150 | end; 151 | FillChar(xKeyD,Sizeof(xKeyD),0); 152 | end; 153 | 154 | procedure TDCP_rc5.Burn; 155 | begin 156 | FillChar(KeyData,Sizeof(KeyData),$FF); 157 | inherited Burn; 158 | end; 159 | 160 | procedure TDCP_rc5.EncryptECB(const InData; var OutData); 161 | var 162 | A, B: DWord; 163 | i: longword; 164 | begin 165 | if not fInitialized then 166 | raise EDCP_blockcipher.Create('Cipher not initialized'); 167 | A:= PDword(@InData)^ + KeyData[0]; 168 | B:= PDword(longword(@InData)+4)^ + KeyData[1]; 169 | for i:= 1 to NUMROUNDS do 170 | begin 171 | A:= A xor B; 172 | A:= LRot32(A,B)+KeyData[2*i]; 173 | B:= B xor A; 174 | B:= LRot32(B,A)+KeyData[(2*i)+1]; 175 | end; 176 | PDword(@OutData)^:= A; 177 | PDword(longword(@OutData)+4)^:= B; 178 | end; 179 | 180 | procedure TDCP_rc5.DecryptECB(const InData; var OutData); 181 | var 182 | A, B: DWord; 183 | i: longword; 184 | begin 185 | if not fInitialized then 186 | raise EDCP_blockcipher.Create('Cipher not initialized'); 187 | A:= PDword(@InData)^; 188 | B:= PDword(longword(@InData)+4)^; 189 | for i:= NUMROUNDS downto 1 do 190 | begin 191 | B:= RRot32(B-KeyData[(2*i)+1],A); 192 | B:= B xor A; 193 | A:= RRot32(A-KeyData[2*i],B); 194 | A:= A xor B; 195 | end; 196 | PDword(@OutData)^:= A - KeyData[0]; 197 | PDword(longword(@OutData)+4)^:= B - KeyData[1]; 198 | end; 199 | 200 | end. 201 | -------------------------------------------------------------------------------- /Ciphers/DCPrc6.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of RC6 **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPrc6; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | const 32 | NUMROUNDS= 20; { number of rounds must be between 16-24 } 33 | 34 | type 35 | TDCP_rc6= class(TDCP_blockcipher128) 36 | protected 37 | KeyData: array[0..((NUMROUNDS*2)+3)] of DWord; 38 | procedure InitKey(const Key; Size: longword); override; 39 | public 40 | class function GetId: integer; override; 41 | class function GetAlgorithm: string; override; 42 | class function GetMaxKeySize: integer; override; 43 | class function SelfTest: boolean; override; 44 | procedure Burn; override; 45 | procedure EncryptECB(const InData; var OutData); override; 46 | procedure DecryptECB(const InData; var OutData); override; 47 | end; 48 | 49 | 50 | {******************************************************************************} 51 | {******************************************************************************} 52 | implementation 53 | {$R-}{$Q-} 54 | 55 | const 56 | sBox: array[0..51] of DWord= ( 57 | $B7E15163,$5618CB1C,$F45044D5,$9287BE8E,$30BF3847,$CEF6B200, 58 | $6D2E2BB9,$0B65A572,$A99D1F2B,$47D498E4,$E60C129D,$84438C56, 59 | $227B060F,$C0B27FC8,$5EE9F981,$FD21733A,$9B58ECF3,$399066AC, 60 | $D7C7E065,$75FF5A1E,$1436D3D7,$B26E4D90,$50A5C749,$EEDD4102, 61 | $8D14BABB,$2B4C3474,$C983AE2D,$67BB27E6,$05F2A19F,$A42A1B58, 62 | $42619511,$E0990ECA,$7ED08883,$1D08023C,$BB3F7BF5,$5976F5AE, 63 | $F7AE6F67,$95E5E920,$341D62D9,$D254DC92,$708C564B,$0EC3D004, 64 | $ACFB49BD,$4B32C376,$E96A3D2F,$87A1B6E8,$25D930A1,$C410AA5A, 65 | $62482413,$007F9DCC,$9EB71785,$3CEE913E); 66 | 67 | 68 | function LRot32(X: DWord; c: longword): DWord; 69 | begin 70 | LRot32:= (X shl c) or (X shr (32 - c)); 71 | end; 72 | 73 | function RRot32(X: DWord; c: longword): DWord; 74 | begin 75 | RRot32:= (X shr c) or (X shl (32 - c)); 76 | end; 77 | 78 | class function TDCP_rc6.GetID: integer; 79 | begin 80 | Result:= DCP_rc6; 81 | end; 82 | 83 | class function TDCP_rc6.GetAlgorithm: string; 84 | begin 85 | Result:= 'RC6'; 86 | end; 87 | 88 | class function TDCP_rc6.GetMaxKeySize: integer; 89 | begin 90 | Result:= 2048; 91 | end; 92 | 93 | class function TDCP_rc6.SelfTest: boolean; 94 | const 95 | Key1: array[0..15] of byte= 96 | ($01,$23,$45,$67,$89,$ab,$cd,$ef,$01,$12,$23,$34,$45,$56,$67,$78); 97 | Plain1: array[0..15] of byte= 98 | ($02,$13,$24,$35,$46,$57,$68,$79,$8a,$9b,$ac,$bd,$ce,$df,$e0,$f1); 99 | Cipher1: array[0..15] of byte= 100 | ($52,$4e,$19,$2f,$47,$15,$c6,$23,$1f,$51,$f6,$36,$7e,$a4,$3f,$18); 101 | Key2: array[0..31] of byte= 102 | ($01,$23,$45,$67,$89,$ab,$cd,$ef,$01,$12,$23,$34,$45,$56,$67,$78, 103 | $89,$9a,$ab,$bc,$cd,$de,$ef,$f0,$10,$32,$54,$76,$98,$ba,$dc,$fe); 104 | Plain2: array[0..15] of byte= 105 | ($02,$13,$24,$35,$46,$57,$68,$79,$8a,$9b,$ac,$bd,$ce,$df,$e0,$f1); 106 | Cipher2: array[0..15] of byte= 107 | ($c8,$24,$18,$16,$f0,$d7,$e4,$89,$20,$ad,$16,$a1,$67,$4e,$5d,$48); 108 | var 109 | Cipher: TDCP_rc6; 110 | Data: array[0..15] of byte; 111 | begin 112 | Cipher:= TDCP_rc6.Create(nil); 113 | Cipher.Init(Key1,Sizeof(Key1)*8,nil); 114 | Cipher.EncryptECB(Plain1,Data); 115 | Result:= boolean(CompareMem(@Data,@Cipher1,Sizeof(Data))); 116 | Cipher.DecryptECB(Data,Data); 117 | Result:= Result and boolean(CompareMem(@Data,@Plain1,Sizeof(Data))); 118 | Cipher.Burn; 119 | Cipher.Init(Key2,Sizeof(Key2)*8,nil); 120 | Cipher.EncryptECB(Plain2,Data); 121 | Result:= Result and boolean(CompareMem(@Data,@Cipher2,Sizeof(Data))); 122 | Cipher.DecryptECB(Data,Data); 123 | Result:= Result and boolean(CompareMem(@Data,@Plain2,Sizeof(Data))); 124 | Cipher.Burn; 125 | Cipher.Free; 126 | end; 127 | 128 | procedure TDCP_rc6.InitKey(const Key; Size: longword); 129 | var 130 | xKeyD: array[0..63] of DWord; 131 | i, j, k, xKeyLen: longword; 132 | A, B: DWord; 133 | begin 134 | Size:= Size div 8; 135 | FillChar(xKeyD,Sizeof(xKeyD),0); 136 | Move(Key,xKeyD,Size); 137 | xKeyLen:= Size div 4; 138 | if (Size mod 4)<> 0 then 139 | Inc(xKeyLen); 140 | Move(sBox,KeyData,((NUMROUNDS*2)+4)*4); 141 | i:= 0; j:= 0; 142 | A:= 0; B:= 0; 143 | if xKeyLen> ((NUMROUNDS*2)+4) then 144 | k:= xKeyLen*3 145 | else 146 | k:= ((NUMROUNDS*2)+4)*3; 147 | for k:= 1 to k do 148 | begin 149 | A:= LRot32(KeyData[i]+A+B,3); 150 | KeyData[i]:= A; 151 | B:= LRot32(xKeyD[j]+A+B,A+B); 152 | xKeyD[j]:= B; 153 | i:= (i+1) mod ((NUMROUNDS*2)+4); 154 | j:= (j+1) mod xKeyLen; 155 | end; 156 | FillChar(xKeyD,Sizeof(xKeyD),0); 157 | end; 158 | 159 | procedure TDCP_rc6.Burn; 160 | begin 161 | FillChar(KeyData,Sizeof(KeyData),$FF); 162 | inherited Burn; 163 | end; 164 | 165 | procedure TDCP_rc6.EncryptECB(const InData; var OutData); 166 | var 167 | x0, x1, x2, x3: DWord; 168 | u, t: DWord; 169 | i: longword; 170 | begin 171 | if not fInitialized then 172 | raise EDCP_blockcipher.Create('Cipher not initialized'); 173 | x0:= PDword(@InData)^; 174 | x1:= PDword(longword(@InData)+4)^; 175 | x2:= PDword(longword(@InData)+8)^; 176 | x3:= PDword(longword(@InData)+12)^; 177 | x1:= x1 + KeyData[0]; 178 | x3:= x3 + KeyData[1]; 179 | for i:= 1 to NUMROUNDS do 180 | begin 181 | t:= Lrot32(x1 * (2*x1 + 1),5); 182 | u:= Lrot32(x3 * (2*x3 + 1),5); 183 | x0:= Lrot32(x0 xor t,u) + KeyData[2*i]; 184 | x2:= Lrot32(x2 xor u,t) + KeyData[2*i+1]; 185 | t:= x0; x0:= x1; x1:= x2; x2:= x3; x3:= t; 186 | end; 187 | x0:= x0 + KeyData[(2*NUMROUNDS)+2]; 188 | x2:= x2 + KeyData[(2*NUMROUNDS)+3]; 189 | PDword(@OutData)^:= x0; 190 | PDword(longword(@OutData)+4)^:= x1; 191 | PDword(longword(@OutData)+8)^:= x2; 192 | PDword(longword(@OutData)+12)^:= x3; 193 | end; 194 | 195 | procedure TDCP_rc6.DecryptECB(const InData; var OutData); 196 | var 197 | x0, x1, x2, x3: DWord; 198 | u, t: DWord; 199 | i: longword; 200 | begin 201 | if not fInitialized then 202 | raise EDCP_blockcipher.Create('Cipher not initialized'); 203 | x0:= PDword(@InData)^; 204 | x1:= PDword(longword(@InData)+4)^; 205 | x2:= PDword(longword(@InData)+8)^; 206 | x3:= PDword(longword(@InData)+12)^; 207 | x2:= x2 - KeyData[(2*NUMROUNDS)+3]; 208 | x0:= x0 - KeyData[(2*NUMROUNDS)+2]; 209 | for i:= NUMROUNDS downto 1 do 210 | begin 211 | t:= x0; x0:= x3; x3:= x2; x2:= x1; x1:= t; 212 | u:= Lrot32(x3 * (2*x3 + 1),5); 213 | t:= Lrot32(x1 * (2*x1 + 1),5); 214 | x2:= Rrot32(x2 - KeyData[2*i+1],t) xor u; 215 | x0:= Rrot32(x0 - KeyData[2*i],u) xor t; 216 | end; 217 | x3:= x3 - KeyData[1]; 218 | x1:= x1 - KeyData[0]; 219 | PDword(@OutData)^:= x0; 220 | PDword(longword(@OutData)+4)^:= x1; 221 | PDword(longword(@OutData)+8)^:= x2; 222 | PDword(longword(@OutData)+12)^:= x3; 223 | end; 224 | 225 | end. 226 | -------------------------------------------------------------------------------- /Ciphers/DCPtea.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of Tea **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPtea; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst, DCPblockciphers; 30 | 31 | type 32 | TDCP_tea= class(TDCP_blockcipher64) 33 | protected 34 | KeyData: array[0..3] of dword; 35 | procedure InitKey(const Key; Size: longword); override; 36 | public 37 | class function GetID: integer; override; 38 | class function GetAlgorithm: string; override; 39 | class function GetMaxKeySize: integer; override; 40 | class function SelfTest: boolean; override; 41 | procedure Burn; override; 42 | procedure EncryptECB(const InData; var OutData); override; 43 | procedure DecryptECB(const InData; var OutData); override; 44 | end; 45 | 46 | 47 | {******************************************************************************} 48 | {******************************************************************************} 49 | implementation 50 | {$R-}{$Q-} 51 | 52 | const 53 | Delta= $9e3779b9; 54 | Rounds= 32; 55 | 56 | function SwapDword(a: dword): dword; 57 | begin 58 | Result:= ((a and $FF) shl 24) or ((a and $FF00) shl 8) or ((a and $FF0000) shr 8) or ((a and $FF000000) shr 24); 59 | end; 60 | 61 | class function TDCP_tea.GetID: integer; 62 | begin 63 | Result:= DCP_tea; 64 | end; 65 | 66 | class function TDCP_tea.GetAlgorithm: string; 67 | begin 68 | Result:= 'Tea'; 69 | end; 70 | 71 | class function TDCP_tea.GetMaxKeySize: integer; 72 | begin 73 | Result:= 128; 74 | end; 75 | 76 | class function TDCP_tea.SelfTest: boolean; 77 | const 78 | Key: array[0..3] of dword= ($12345678,$9ABCDEF0,$0FEDCBA9,$87654321); 79 | PT: array[0..1] of dword= ($12345678,$9ABCDEF0); 80 | var 81 | Data: array[0..1] of dword; 82 | Cipher: TDCP_tea; 83 | begin 84 | Cipher:= TDCP_tea.Create(nil); 85 | Cipher.Init(Key,Sizeof(Key)*8,nil); 86 | Cipher.EncryptECB(PT,Data); 87 | Result:= not CompareMem(@Data,@PT,Sizeof(PT)); 88 | Cipher.DecryptECB(Data,Data); 89 | Result:= Result and CompareMem(@Data,@PT,Sizeof(PT)); 90 | Cipher.Burn; 91 | Cipher.Free; 92 | end; 93 | 94 | procedure TDCP_tea.InitKey(const Key; Size: longword); 95 | begin 96 | FillChar(KeyData,Sizeof(KeyData),0); 97 | Move(Key,KeyData,Size div 8); 98 | KeyData[0]:= SwapDWord(KeyData[0]); KeyData[1]:= SwapDWord(KeyData[1]); 99 | KeyData[2]:= SwapDWord(KeyData[2]); KeyData[3]:= SwapDWord(KeyData[3]); 100 | end; 101 | 102 | procedure TDCP_tea.Burn; 103 | begin 104 | FillChar(KeyData,Sizeof(KeyData),0); 105 | inherited Burn; 106 | end; 107 | 108 | procedure TDCP_tea.EncryptECB(const InData; var OutData); 109 | var 110 | a, b, c, d, x, y, n, sum: dword; 111 | begin 112 | if not fInitialized then 113 | raise EDCP_blockcipher.Create('Cipher not initialized'); 114 | 115 | x:= SwapDWord(pdword(@InData)^); 116 | y:= SwapDWord(pdword(longword(@InData)+4)^); 117 | sum:= 0; a:= KeyData[0]; b:= KeyData[1]; c:= KeyData[2]; d:= KeyData[3]; 118 | for n:= 1 to Rounds do 119 | begin 120 | Inc(sum,Delta); 121 | Inc(x,(y shl 4) + (a xor y) + (sum xor (y shr 5)) + b); 122 | Inc(y,(x shl 4) + (c xor x) + (sum xor (x shr 5)) + d); 123 | end; 124 | pdword(@OutData)^:= SwapDWord(x); 125 | pdword(longword(@OutData)+4)^:= SwapDWord(y); 126 | end; 127 | 128 | procedure TDCP_tea.DecryptECB(const InData; var OutData); 129 | var 130 | a, b, c, d, x, y, n, sum: dword; 131 | begin 132 | if not fInitialized then 133 | raise EDCP_blockcipher.Create('Cipher not initialized'); 134 | 135 | x:= SwapDWord(pdword(@InData)^); 136 | y:= SwapDWord(pdword(longword(@InData)+4)^); 137 | sum:= Delta shl 5; a:= KeyData[0]; b:= KeyData[1]; c:= KeyData[2]; d:= KeyData[3]; 138 | for n:= 1 to Rounds do 139 | begin 140 | Dec(y,(x shl 4) + (c xor x) + (sum xor (x shr 5)) + d); 141 | Dec(x,(y shl 4) + (a xor y) + (sum xor (y shr 5)) + b); 142 | Dec(sum,Delta); 143 | end; 144 | pdword(@OutData)^:= SwapDWord(x); 145 | pdword(longword(@OutData)+4)^:= SwapDWord(y); 146 | end; 147 | 148 | end. 149 | -------------------------------------------------------------------------------- /Ciphers/DCPtwofish.inc: -------------------------------------------------------------------------------- 1 | const 2 | p8x8: array[0..1,0..255] of byte= (( 3 | $a9, $67, $b3, $e8, $04, $fd, $a3, $76, 4 | $9a, $92, $80, $78, $e4, $dd, $d1, $38, 5 | $0d, $c6, $35, $98, $18, $f7, $ec, $6c, 6 | $43, $75, $37, $26, $fa, $13, $94, $48, 7 | $f2, $d0, $8b, $30, $84, $54, $df, $23, 8 | $19, $5b, $3d, $59, $f3, $ae, $a2, $82, 9 | $63, $01, $83, $2e, $d9, $51, $9b, $7c, 10 | $a6, $eb, $a5, $be, $16, $0c, $e3, $61, 11 | $c0, $8c, $3a, $f5, $73, $2c, $25, $0b, 12 | $bb, $4e, $89, $6b, $53, $6a, $b4, $f1, 13 | $e1, $e6, $bd, $45, $e2, $f4, $b6, $66, 14 | $cc, $95, $03, $56, $d4, $1c, $1e, $d7, 15 | $fb, $c3, $8e, $b5, $e9, $cf, $bf, $ba, 16 | $ea, $77, $39, $af, $33, $c9, $62, $71, 17 | $81, $79, $09, $ad, $24, $cd, $f9, $d8, 18 | $e5, $c5, $b9, $4d, $44, $08, $86, $e7, 19 | $a1, $1d, $aa, $ed, $06, $70, $b2, $d2, 20 | $41, $7b, $a0, $11, $31, $c2, $27, $90, 21 | $20, $f6, $60, $ff, $96, $5c, $b1, $ab, 22 | $9e, $9c, $52, $1b, $5f, $93, $0a, $ef, 23 | $91, $85, $49, $ee, $2d, $4f, $8f, $3b, 24 | $47, $87, $6d, $46, $d6, $3e, $69, $64, 25 | $2a, $ce, $cb, $2f, $fc, $97, $05, $7a, 26 | $ac, $7f, $d5, $1a, $4b, $0e, $a7, $5a, 27 | $28, $14, $3f, $29, $88, $3c, $4c, $02, 28 | $b8, $da, $b0, $17, $55, $1f, $8a, $7d, 29 | $57, $c7, $8d, $74, $b7, $c4, $9f, $72, 30 | $7e, $15, $22, $12, $58, $07, $99, $34, 31 | $6e, $50, $de, $68, $65, $bc, $db, $f8, 32 | $c8, $a8, $2b, $40, $dc, $fe, $32, $a4, 33 | $ca, $10, $21, $f0, $d3, $5d, $0f, $00, 34 | $6f, $9d, $36, $42, $4a, $5e, $c1, $e0),( 35 | $75, $f3, $c6, $f4, $db, $7b, $fb, $c8, 36 | $4a, $d3, $e6, $6b, $45, $7d, $e8, $4b, 37 | $d6, $32, $d8, $fd, $37, $71, $f1, $e1, 38 | $30, $0f, $f8, $1b, $87, $fa, $06, $3f, 39 | $5e, $ba, $ae, $5b, $8a, $00, $bc, $9d, 40 | $6d, $c1, $b1, $0e, $80, $5d, $d2, $d5, 41 | $a0, $84, $07, $14, $b5, $90, $2c, $a3, 42 | $b2, $73, $4c, $54, $92, $74, $36, $51, 43 | $38, $b0, $bd, $5a, $fc, $60, $62, $96, 44 | $6c, $42, $f7, $10, $7c, $28, $27, $8c, 45 | $13, $95, $9c, $c7, $24, $46, $3b, $70, 46 | $ca, $e3, $85, $cb, $11, $d0, $93, $b8, 47 | $a6, $83, $20, $ff, $9f, $77, $c3, $cc, 48 | $03, $6f, $08, $bf, $40, $e7, $2b, $e2, 49 | $79, $0c, $aa, $82, $41, $3a, $ea, $b9, 50 | $e4, $9a, $a4, $97, $7e, $da, $7a, $17, 51 | $66, $94, $a1, $1d, $3d, $f0, $de, $b3, 52 | $0b, $72, $a7, $1c, $ef, $d1, $53, $3e, 53 | $8f, $33, $26, $5f, $ec, $76, $2a, $49, 54 | $81, $88, $ee, $21, $c4, $1a, $eb, $d9, 55 | $c5, $39, $99, $cd, $ad, $31, $8b, $01, 56 | $18, $23, $dd, $1f, $4e, $2d, $f9, $48, 57 | $4f, $f2, $65, $8e, $78, $5c, $58, $19, 58 | $8d, $e5, $98, $57, $67, $7f, $05, $64, 59 | $af, $63, $b6, $fe, $f5, $b7, $3c, $a5, 60 | $ce, $e9, $68, $44, $e0, $4d, $43, $69, 61 | $29, $2e, $ac, $15, $59, $a8, $0a, $9e, 62 | $6e, $47, $df, $34, $35, $6a, $cf, $dc, 63 | $22, $c9, $c0, $9b, $89, $d4, $ed, $ab, 64 | $12, $a2, $0d, $52, $bb, $02, $2f, $a9, 65 | $d7, $61, $1e, $b4, $50, $04, $f6, $c2, 66 | $16, $25, $86, $56, $55, $09, $be, $91)); 67 | -------------------------------------------------------------------------------- /DCPbase64.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A Base64 encoding/decoding unit ********************************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPbase64; 26 | 27 | interface 28 | uses 29 | Sysutils; 30 | 31 | function Base64EncodeStr(const Value: AnsiString): AnsiString; overload; 32 | { Encode a string into Base64 format } 33 | function Base64DecodeStr(const Value: AnsiString): AnsiString; overload; 34 | { Decode a Base64 format string } 35 | {$IFDEF UNICODE} 36 | function Base64EncodeStr(const Value: UnicodeString): UnicodeString; overload; 37 | { Encode a Unicode string into Base64 format } 38 | function Base64DecodeStr(const Value: UnicodeString): UnicodeString; overload; 39 | { Decode a Base64 format Unicode string } 40 | {$ENDIF} 41 | function Base64Encode(pInput: pointer; pOutput: pointer; Size: longint): longint; 42 | { Encode a lump of raw data (output is (4/3) times bigger than input) } 43 | function Base64Decode(pInput: pointer; pOutput: pointer; Size: longint): longint; 44 | { Decode a lump of raw data } 45 | 46 | 47 | {******************************************************************************} 48 | {******************************************************************************} 49 | implementation 50 | {$Q-}{$R-} 51 | 52 | const 53 | B64: array[0..63] of byte= (65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80, 54 | 81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108, 55 | 109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53, 56 | 54,55,56,57,43,47); 57 | 58 | function Base64Encode(pInput: pointer; pOutput: pointer; Size: longint): longint; 59 | var 60 | i, iptr, optr: integer; 61 | Input, Output: PByteArray; 62 | begin 63 | Input:= PByteArray(pInput); Output:= PByteArray(pOutput); 64 | iptr:= 0; optr:= 0; 65 | for i:= 1 to (Size div 3) do 66 | begin 67 | Output^[optr+0]:= B64[Input^[iptr] shr 2]; 68 | Output^[optr+1]:= B64[((Input^[iptr] and 3) shl 4) + (Input^[iptr+1] shr 4)]; 69 | Output^[optr+2]:= B64[((Input^[iptr+1] and 15) shl 2) + (Input^[iptr+2] shr 6)]; 70 | Output^[optr+3]:= B64[Input^[iptr+2] and 63]; 71 | Inc(optr,4); Inc(iptr,3); 72 | end; 73 | case (Size mod 3) of 74 | 1: begin 75 | Output^[optr+0]:= B64[Input^[iptr] shr 2]; 76 | Output^[optr+1]:= B64[(Input^[iptr] and 3) shl 4]; 77 | Output^[optr+2]:= byte('='); 78 | Output^[optr+3]:= byte('='); 79 | end; 80 | 2: begin 81 | Output^[optr+0]:= B64[Input^[iptr] shr 2]; 82 | Output^[optr+1]:= B64[((Input^[iptr] and 3) shl 4) + (Input^[iptr+1] shr 4)]; 83 | Output^[optr+2]:= B64[(Input^[iptr+1] and 15) shl 2]; 84 | Output^[optr+3]:= byte('='); 85 | end; 86 | end; 87 | Result:= ((Size+2) div 3) * 4; 88 | end; 89 | 90 | function Base64EncodeStr(const Value: AnsiString): AnsiString; 91 | begin 92 | SetLength(Result,((Length(Value)+2) div 3) * 4); 93 | Base64Encode(@Value[1],@Result[1],Length(Value)); 94 | end; 95 | 96 | {$IFDEF UNICODE} 97 | function Base64EncodeStr(const Value: UnicodeString): UnicodeString; 98 | var 99 | temp: AnsiString; 100 | begin 101 | SetLength(temp,(((Length(Value)*SizeOf(Value[1])+2) div 3) * 4)); 102 | Base64Encode(@Value[1],@temp[1],Length(Value)*SizeOf(Value[1])); 103 | Result:= UnicodeString(temp); 104 | end; 105 | {$ENDIF} 106 | 107 | function Base64Decode(pInput: pointer; pOutput: pointer; Size: longint): longint; 108 | var 109 | i, j, iptr, optr: integer; 110 | Temp: array[0..3] of byte; 111 | Input, Output: PByteArray; 112 | begin 113 | Input:= PByteArray(pInput); Output:= PByteArray(pOutput); 114 | iptr:= 0; optr:= 0; 115 | Result:= 0; 116 | for i:= 1 to (Size div 4) do 117 | begin 118 | for j:= 0 to 3 do 119 | begin 120 | case Input^[iptr] of 121 | 65..90 : Temp[j]:= Input^[iptr] - Ord('A'); 122 | 97..122: Temp[j]:= Input^[iptr] - Ord('a') + 26; 123 | 48..57 : Temp[j]:= Input^[iptr] - Ord('0') + 52; 124 | 43 : Temp[j]:= 62; 125 | 47 : Temp[j]:= 63; 126 | 61 : Temp[j]:= $FF; 127 | end; 128 | Inc(iptr); 129 | end; 130 | Output^[optr]:= (Temp[0] shl 2) or (Temp[1] shr 4); 131 | Result:= optr+1; 132 | if (Temp[2]<> $FF) and (Temp[3]= $FF) then 133 | begin 134 | Output^[optr+1]:= (Temp[1] shl 4) or (Temp[2] shr 2); 135 | Result:= optr+2; 136 | Inc(optr) 137 | end 138 | else if (Temp[2]<> $FF) then 139 | begin 140 | Output^[optr+1]:= (Temp[1] shl 4) or (Temp[2] shr 2); 141 | Output^[optr+2]:= (Temp[2] shl 6) or Temp[3]; 142 | Result:= optr+3; 143 | Inc(optr,2); 144 | end; 145 | Inc(optr); 146 | end; 147 | end; 148 | 149 | function Base64DecodeStr(const Value: AnsiString): AnsiString; 150 | begin 151 | SetLength(Result,(Length(Value) div 4) * 3); 152 | SetLength(Result,Base64Decode(@Value[1],@Result[1],Length(Value))); 153 | end; 154 | 155 | {$IFDEF UNICODE} 156 | function Base64DecodeStr(const Value: UnicodeString): UnicodeString; 157 | var 158 | temp: AnsiString; 159 | begin 160 | temp:= AnsiString(Value); 161 | SetLength(Result,(Length(temp) div 4) * 3); 162 | SetLength(Result,Base64Decode(@temp[1],@Result[1],Length(temp)) div SizeOf(Result[1])); 163 | end; 164 | {$ENDIF} 165 | 166 | end. 167 | -------------------------------------------------------------------------------- /DCPbase64_new.pas: -------------------------------------------------------------------------------- 1 | unit DCPBase64_new; 2 | 3 | interface 4 | 5 | uses 6 | SysUtils, DCPtypes; 7 | 8 | { Base64 encode and decode a string } 9 | function B64Encode(const S: string): string; 10 | function B64Decode(const S: string): string; 11 | 12 | {******************************************************************************} 13 | {******************************************************************************} 14 | implementation 15 | 16 | const 17 | B64Table= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; 18 | 19 | function B64Encode; 20 | var 21 | i: integer; 22 | InBuf: array[0..2] of byte; 23 | OutBuf: array[0..3] of char; 24 | begin 25 | SetLength(Result,((Length(S)+2) div 3)*4); 26 | for i:= 1 to ((Length(S)+2) div 3) do 27 | begin 28 | if Length(S)< (i*3) then 29 | Move(S[(i-1)*3+1],InBuf,Length(S)-(i-1)*3) 30 | else 31 | Move(S[(i-1)*3+1],InBuf,3); 32 | OutBuf[0]:= B64Table[((InBuf[0] and $FC) shr 2) + 1]; 33 | OutBuf[1]:= B64Table[(((InBuf[0] and $03) shl 4) or ((InBuf[1] and $F0) shr 4)) + 1]; 34 | OutBuf[2]:= B64Table[(((InBuf[1] and $0F) shl 2) or ((InBuf[2] and $C0) shr 6)) + 1]; 35 | OutBuf[3]:= B64Table[(InBuf[2] and $3F) + 1]; 36 | Move(OutBuf,Result[(i-1)*4+1],4); 37 | end; 38 | if (Length(S) mod 3)= 1 then 39 | begin 40 | Result[Length(Result)-1]:= '='; 41 | Result[Length(Result)]:= '='; 42 | end 43 | else if (Length(S) mod 3)= 2 then 44 | Result[Length(Result)]:= '='; 45 | end; 46 | 47 | function B64Decode; 48 | var 49 | i: integer; 50 | InBuf: array[0..3] of byte; 51 | OutBuf: array[0..2] of byte; 52 | begin 53 | if (Length(S) mod 4)<> 0 then 54 | raise Exception.Create('Base64: Incorrect string format'); 55 | SetLength(Result,((Length(S) div 4)-1)*3); 56 | for i:= 1 to ((Length(S) div 4)-1) do 57 | begin 58 | Move(S[(i-1)*4+1],InBuf,4); 59 | if (InBuf[0]> 64) and (InBuf[0]< 91) then 60 | Dec(InBuf[0],65) 61 | else if (InBuf[0]> 96) and (InBuf[0]< 123) then 62 | Dec(InBuf[0],71) 63 | else if (InBuf[0]> 47) and (InBuf[0]< 58) then 64 | Inc(InBuf[0],4) 65 | else if InBuf[0]= 43 then 66 | InBuf[0]:= 62 67 | else 68 | InBuf[0]:= 63; 69 | if (InBuf[1]> 64) and (InBuf[1]< 91) then 70 | Dec(InBuf[1],65) 71 | else if (InBuf[1]> 96) and (InBuf[1]< 123) then 72 | Dec(InBuf[1],71) 73 | else if (InBuf[1]> 47) and (InBuf[1]< 58) then 74 | Inc(InBuf[1],4) 75 | else if InBuf[1]= 43 then 76 | InBuf[1]:= 62 77 | else 78 | InBuf[1]:= 63; 79 | if (InBuf[2]> 64) and (InBuf[2]< 91) then 80 | Dec(InBuf[2],65) 81 | else if (InBuf[2]> 96) and (InBuf[2]< 123) then 82 | Dec(InBuf[2],71) 83 | else if (InBuf[2]> 47) and (InBuf[2]< 58) then 84 | Inc(InBuf[2],4) 85 | else if InBuf[2]= 43 then 86 | InBuf[2]:= 62 87 | else 88 | InBuf[2]:= 63; 89 | if (InBuf[3]> 64) and (InBuf[3]< 91) then 90 | Dec(InBuf[3],65) 91 | else if (InBuf[3]> 96) and (InBuf[3]< 123) then 92 | Dec(InBuf[3],71) 93 | else if (InBuf[3]> 47) and (InBuf[3]< 58) then 94 | Inc(InBuf[3],4) 95 | else if InBuf[3]= 43 then 96 | InBuf[3]:= 62 97 | else 98 | InBuf[3]:= 63; 99 | OutBuf[0]:= (InBuf[0] shl 2) or ((InBuf[1] shr 4) and $03); 100 | OutBuf[1]:= (InBuf[1] shl 4) or ((InBuf[2] shr 2) and $0F); 101 | OutBuf[2]:= (InBuf[2] shl 6) or (InBuf[3] and $3F); 102 | Move(OutBuf,Result[(i-1)*3+1],3); 103 | end; 104 | if Length(S)<> 0 then 105 | begin 106 | Move(S[Length(S)-3],InBuf,4); 107 | if InBuf[2]= 61 then 108 | begin 109 | if (InBuf[0]> 64) and (InBuf[0]< 91) then 110 | Dec(InBuf[0],65) 111 | else if (InBuf[0]> 96) and (InBuf[0]< 123) then 112 | Dec(InBuf[0],71) 113 | else if (InBuf[0]> 47) and (InBuf[0]< 58) then 114 | Inc(InBuf[0],4) 115 | else if InBuf[0]= 43 then 116 | InBuf[0]:= 62 117 | else 118 | InBuf[0]:= 63; 119 | if (InBuf[1]> 64) and (InBuf[1]< 91) then 120 | Dec(InBuf[1],65) 121 | else if (InBuf[1]> 96) and (InBuf[1]< 123) then 122 | Dec(InBuf[1],71) 123 | else if (InBuf[1]> 47) and (InBuf[1]< 58) then 124 | Inc(InBuf[1],4) 125 | else if InBuf[1]= 43 then 126 | InBuf[1]:= 62 127 | else 128 | InBuf[1]:= 63; 129 | OutBuf[0]:= (InBuf[0] shl 2) or ((InBuf[1] shr 4) and $03); 130 | Result:= Result + char(OutBuf[0]); 131 | end 132 | else if InBuf[3]= 61 then 133 | begin 134 | if (InBuf[0]> 64) and (InBuf[0]< 91) then 135 | Dec(InBuf[0],65) 136 | else if (InBuf[0]> 96) and (InBuf[0]< 123) then 137 | Dec(InBuf[0],71) 138 | else if (InBuf[0]> 47) and (InBuf[0]< 58) then 139 | Inc(InBuf[0],4) 140 | else if InBuf[0]= 43 then 141 | InBuf[0]:= 62 142 | else 143 | InBuf[0]:= 63; 144 | if (InBuf[1]> 64) and (InBuf[1]< 91) then 145 | Dec(InBuf[1],65) 146 | else if (InBuf[1]> 96) and (InBuf[1]< 123) then 147 | Dec(InBuf[1],71) 148 | else if (InBuf[1]> 47) and (InBuf[1]< 58) then 149 | Inc(InBuf[1],4) 150 | else if InBuf[1]= 43 then 151 | InBuf[1]:= 62 152 | else 153 | InBuf[1]:= 63; 154 | if (InBuf[2]> 64) and (InBuf[2]< 91) then 155 | Dec(InBuf[2],65) 156 | else if (InBuf[2]> 96) and (InBuf[2]< 123) then 157 | Dec(InBuf[2],71) 158 | else if (InBuf[2]> 47) and (InBuf[2]< 58) then 159 | Inc(InBuf[2],4) 160 | else if InBuf[2]= 43 then 161 | InBuf[2]:= 62 162 | else 163 | InBuf[2]:= 63; 164 | OutBuf[0]:= (InBuf[0] shl 2) or ((InBuf[1] shr 4) and $03); 165 | OutBuf[1]:= (InBuf[1] shl 4) or ((InBuf[2] shr 2) and $0F); 166 | Result:= Result + char(OutBuf[0]) + char(OutBuf[1]); 167 | end 168 | else 169 | begin 170 | if (InBuf[0]> 64) and (InBuf[0]< 91) then 171 | Dec(InBuf[0],65) 172 | else if (InBuf[0]> 96) and (InBuf[0]< 123) then 173 | Dec(InBuf[0],71) 174 | else if (InBuf[0]> 47) and (InBuf[0]< 58) then 175 | Inc(InBuf[0],4) 176 | else if InBuf[0]= 43 then 177 | InBuf[0]:= 62 178 | else 179 | InBuf[0]:= 63; 180 | if (InBuf[1]> 64) and (InBuf[1]< 91) then 181 | Dec(InBuf[1],65) 182 | else if (InBuf[1]> 96) and (InBuf[1]< 123) then 183 | Dec(InBuf[1],71) 184 | else if (InBuf[1]> 47) and (InBuf[1]< 58) then 185 | Inc(InBuf[1],4) 186 | else if InBuf[1]= 43 then 187 | InBuf[1]:= 62 188 | else 189 | InBuf[1]:= 63; 190 | if (InBuf[2]> 64) and (InBuf[2]< 91) then 191 | Dec(InBuf[2],65) 192 | else if (InBuf[2]> 96) and (InBuf[2]< 123) then 193 | Dec(InBuf[2],71) 194 | else if (InBuf[2]> 47) and (InBuf[2]< 58) then 195 | Inc(InBuf[2],4) 196 | else if InBuf[2]= 43 then 197 | InBuf[2]:= 62 198 | else 199 | InBuf[2]:= 63; 200 | if (InBuf[3]> 64) and (InBuf[3]< 91) then 201 | Dec(InBuf[3],65) 202 | else if (InBuf[3]> 96) and (InBuf[3]< 123) then 203 | Dec(InBuf[3],71) 204 | else if (InBuf[3]> 47) and (InBuf[3]< 58) then 205 | Inc(InBuf[3],4) 206 | else if InBuf[3]= 43 then 207 | InBuf[3]:= 62 208 | else 209 | InBuf[3]:= 63; 210 | OutBuf[0]:= (InBuf[0] shl 2) or ((InBuf[1] shr 4) and $03); 211 | OutBuf[1]:= (InBuf[1] shl 4) or ((InBuf[2] shr 2) and $0F); 212 | OutBuf[2]:= (InBuf[2] shl 6) or (InBuf[3] and $3F); 213 | Result:= Result + Char(OutBuf[0]) + Char(OutBuf[1]) + Char(OutBuf[2]); 214 | end; 215 | end; 216 | end; 217 | 218 | end. 219 | 220 | -------------------------------------------------------------------------------- /DCPciphers.dcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPciphers.dcr -------------------------------------------------------------------------------- /DCPconst.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* Constants for use with DCPcrypt ********************************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPconst; 26 | 27 | interface 28 | 29 | {******************************************************************************} 30 | const 31 | { Component registration } 32 | DCPcipherpage = 'DCPciphers'; 33 | DCPhashpage = 'DCPhashes'; 34 | 35 | { ID values } 36 | DCP_rc2 = 1; 37 | DCP_sha1 = 2; 38 | DCP_rc5 = 3; 39 | DCP_rc6 = 4; 40 | DCP_blowfish = 5; 41 | DCP_twofish = 6; 42 | DCP_cast128 = 7; 43 | DCP_gost = 8; 44 | DCP_rijndael = 9; 45 | DCP_ripemd160 = 10; 46 | DCP_misty1 = 11; 47 | DCP_idea = 12; 48 | DCP_mars = 13; 49 | DCP_haval = 14; 50 | DCP_cast256 = 15; 51 | DCP_md5 = 16; 52 | DCP_md4 = 17; 53 | DCP_tiger = 18; 54 | DCP_rc4 = 19; 55 | DCP_ice = 20; 56 | DCP_thinice = 21; 57 | DCP_ice2 = 22; 58 | DCP_des = 23; 59 | DCP_3des = 24; 60 | DCP_tea = 25; 61 | DCP_serpent = 26; 62 | DCP_ripemd128 = 27; 63 | DCP_sha256 = 28; 64 | DCP_sha384 = 29; 65 | DCP_sha512 = 30; 66 | 67 | 68 | {******************************************************************************} 69 | {******************************************************************************} 70 | implementation 71 | 72 | end. 73 | -------------------------------------------------------------------------------- /DCPcppbuilder5.bpk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | [Version Info] 54 | IncludeVerInfo=1 55 | AutoIncBuild=0 56 | MajorVer=1 57 | MinorVer=0 58 | Release=0 59 | Build=0 60 | Debug=0 61 | PreRelease=0 62 | Special=0 63 | Private=0 64 | DLL=0 65 | Locale=2057 66 | CodePage=1252 67 | 68 | [Version Info Keys] 69 | CompanyName= 70 | FileDescription=DCPcrypt cryptographic component library v2 BETA 3 71 | FileVersion=2.0.0.0 72 | InternalName=DCPcrypt 73 | LegalCopyright=Copyright © 1999-2002 David Barton 74 | LegalTrademarks= 75 | OriginalFilename= 76 | ProductName=DCPcrypt 77 | ProductVersion=2.0.0.0 78 | Comments=Web: http://www.cityinthesky.co.uk/ Email:crypto@cityinthesky.co.uk 79 | 80 | [Debugging] 81 | DebugSourceDirs=$(BCB)\source\vcl 82 | 83 | [Parameters] 84 | RunParams= 85 | HostApplication= 86 | RemoteHost= 87 | RemotePath= 88 | RemoteDebug=0 89 | 90 | [Compiler] 91 | ShowInfoMsgs=0 92 | LinkDebugVcl=0 93 | LinkCGLIB=0 94 | 95 | [Language] 96 | ActiveLang= 97 | ProjectLang= 98 | RootDir= 99 | 100 | -------------------------------------------------------------------------------- /DCPcppbuilder5.cpp: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------- 2 | 3 | #include 4 | #pragma hdrstop 5 | USERES("DCPcppbuilder5.res"); 6 | USEPACKAGE("vcl50.bpi"); 7 | USEUNIT("DCPbase64.pas"); 8 | USEUNIT("DCPblockciphers.pas"); 9 | USEUNIT("DCPconst.pas"); 10 | USEUNIT("DCPcrypt2.pas"); 11 | USEUNIT("DCPreg.pas"); 12 | USEUNIT("Ciphers\DCPblowfish.pas"); 13 | USEUNIT("Ciphers\DCPcast128.pas"); 14 | USEUNIT("Ciphers\DCPcast256.pas"); 15 | USEUNIT("Ciphers\DCPdes.pas"); 16 | USEUNIT("Ciphers\DCPgost.pas"); 17 | USEUNIT("Ciphers\DCPice.pas"); 18 | USEUNIT("Ciphers\DCPidea.pas"); 19 | USEUNIT("Ciphers\DCPmars.pas"); 20 | USEUNIT("Ciphers\DCPmisty1.pas"); 21 | USEUNIT("Ciphers\DCPrc2.pas"); 22 | USEUNIT("Ciphers\DCPrc4.pas"); 23 | USEUNIT("Ciphers\DCPrc5.pas"); 24 | USEUNIT("Ciphers\DCPrc6.pas"); 25 | USEUNIT("Ciphers\DCPrijndael.pas"); 26 | USEUNIT("Ciphers\DCPserpent.pas"); 27 | USEUNIT("Ciphers\DCPtea.pas"); 28 | USEUNIT("Ciphers\DCPtwofish.pas"); 29 | USEUNIT("Hashes\DCPhaval.pas"); 30 | USEUNIT("Hashes\DCPmd4.pas"); 31 | USEUNIT("Hashes\DCPmd5.pas"); 32 | USEUNIT("Hashes\DCPripemd128.pas"); 33 | USEUNIT("Hashes\DCPripemd160.pas"); 34 | USEUNIT("Hashes\DCPsha1.pas"); 35 | USEUNIT("Hashes\DCPsha256.pas"); 36 | USEUNIT("Hashes\DCPsha512.pas"); 37 | USEUNIT("Hashes\DCPtiger.pas"); 38 | //--------------------------------------------------------------------------- 39 | #pragma package(smart_init) 40 | //--------------------------------------------------------------------------- 41 | 42 | // Package source. 43 | //--------------------------------------------------------------------------- 44 | 45 | #pragma argsused 46 | int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) 47 | { 48 | return 1; 49 | } 50 | //--------------------------------------------------------------------------- 51 | -------------------------------------------------------------------------------- /DCPcppbuilder5.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPcppbuilder5.res -------------------------------------------------------------------------------- /DCPdelphi2007.cfg: -------------------------------------------------------------------------------- 1 | -$A8 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J- 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 29 | -H+ 30 | -W+ 31 | -M 32 | -$M16384,1048576 33 | -K$00400000 34 | -LE"c:\program files\borland\delphi6\Projects\Bpl" 35 | -LN"c:\program files\borland\delphi6\Projects\Bpl" 36 | -Z 37 | -------------------------------------------------------------------------------- /DCPdelphi2007.dof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi2007.dof -------------------------------------------------------------------------------- /DCPdelphi2007.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphi2007; 2 | 3 | {$R *.res} 4 | {$ALIGN 8} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST OFF} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$IMPLICITBUILD ON} 27 | 28 | requires 29 | rtl; 30 | 31 | contains 32 | DCPbase64 in 'DCPbase64.pas', 33 | DCPblockciphers in 'DCPblockciphers.pas', 34 | DCPconst in 'DCPconst.pas', 35 | DCPcrypt2 in 'DCPcrypt2.pas', 36 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 37 | DCPcast128 in 'Ciphers\DCPcast128.pas', 38 | DCPcast256 in 'Ciphers\DCPcast256.pas', 39 | DCPdes in 'Ciphers\DCPdes.pas', 40 | DCPgost in 'Ciphers\DCPgost.pas', 41 | DCPice in 'Ciphers\DCPice.pas', 42 | DCPidea in 'Ciphers\DCPidea.pas', 43 | DCPmars in 'Ciphers\DCPmars.pas', 44 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 45 | DCPrc2 in 'Ciphers\DCPrc2.pas', 46 | DCPrc4 in 'Ciphers\DCPrc4.pas', 47 | DCPrc5 in 'Ciphers\DCPrc5.pas', 48 | DCPrc6 in 'Ciphers\DCPrc6.pas', 49 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 50 | DCPtea in 'Ciphers\DCPtea.pas', 51 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 52 | DCPhaval in 'Hashes\DCPhaval.pas', 53 | DCPmd4 in 'Hashes\DCPmd4.pas', 54 | DCPmd5 in 'Hashes\DCPmd5.pas', 55 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 56 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 57 | DCPsha1 in 'Hashes\DCPsha1.pas', 58 | DCPtiger in 'Hashes\DCPtiger.pas', 59 | DCPreg in 'DCPreg.pas', 60 | DCPserpent in 'Ciphers\DCPserpent.pas', 61 | DCPsha256 in 'Hashes\DCPsha256.pas', 62 | DCPsha512 in 'Hashes\DCPsha512.pas'; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /DCPdelphi2007.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi2007.res -------------------------------------------------------------------------------- /DCPdelphi2009.cfg: -------------------------------------------------------------------------------- 1 | -$A8 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J- 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 29 | -H+ 30 | -W+ 31 | -M 32 | -$M16384,1048576 33 | -K$00400000 34 | -LE"c:\program files\borland\delphi6\Projects\Bpl" 35 | -LN"c:\program files\borland\delphi6\Projects\Bpl" 36 | -Z 37 | -------------------------------------------------------------------------------- /DCPdelphi2009.dof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi2009.dof -------------------------------------------------------------------------------- /DCPdelphi2009.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphi2009; 2 | 3 | {$R *.res} 4 | {$ALIGN 8} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST OFF} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$IMPLICITBUILD ON} 27 | 28 | requires 29 | rtl; 30 | 31 | contains 32 | DCPbase64 in 'DCPbase64.pas', 33 | DCPblockciphers in 'DCPblockciphers.pas', 34 | DCPconst in 'DCPconst.pas', 35 | DCPcrypt2 in 'DCPcrypt2.pas', 36 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 37 | DCPcast128 in 'Ciphers\DCPcast128.pas', 38 | DCPcast256 in 'Ciphers\DCPcast256.pas', 39 | DCPdes in 'Ciphers\DCPdes.pas', 40 | DCPgost in 'Ciphers\DCPgost.pas', 41 | DCPice in 'Ciphers\DCPice.pas', 42 | DCPidea in 'Ciphers\DCPidea.pas', 43 | DCPmars in 'Ciphers\DCPmars.pas', 44 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 45 | DCPrc2 in 'Ciphers\DCPrc2.pas', 46 | DCPrc4 in 'Ciphers\DCPrc4.pas', 47 | DCPrc5 in 'Ciphers\DCPrc5.pas', 48 | DCPrc6 in 'Ciphers\DCPrc6.pas', 49 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 50 | DCPtea in 'Ciphers\DCPtea.pas', 51 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 52 | DCPhaval in 'Hashes\DCPhaval.pas', 53 | DCPmd4 in 'Hashes\DCPmd4.pas', 54 | DCPmd5 in 'Hashes\DCPmd5.pas', 55 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 56 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 57 | DCPsha1 in 'Hashes\DCPsha1.pas', 58 | DCPtiger in 'Hashes\DCPtiger.pas', 59 | DCPreg in 'DCPreg.pas', 60 | DCPserpent in 'Ciphers\DCPserpent.pas', 61 | DCPsha256 in 'Hashes\DCPsha256.pas', 62 | DCPsha512 in 'Hashes\DCPsha512.pas'; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /DCPdelphi2009.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {ae9b70a6-b2c2-45a0-ba7b-2448a376d73f} 4 | DCPdelphi2009.dpk 5 | Debug 6 | AnyCPU 7 | DCC32 8 | C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl\DCPdelphi2009.bpl 9 | 12.0 10 | Debug 11 | 12 | 13 | true 14 | 15 | 16 | true 17 | Base 18 | true 19 | 20 | 21 | true 22 | Base 23 | true 24 | 25 | 26 | 00400000 27 | C:\Documents and Settings\All Users\Documents\RAD Studio\6.0\Bpl\DCPdelphi2009.bpl 28 | DCPcrypt cryptographic component library v2 BETA 3 29 | false 30 | true 31 | true 32 | 1 33 | 34 | 35 | 7.0 36 | False 37 | False 38 | 0 39 | RELEASE;$(DCC_Define) 40 | 41 | 42 | 7.0 43 | 44 | 45 | Delphi.Personality.12 46 | Package 47 | 48 | 49 | 50 | False 51 | True 52 | False 53 | 54 | 55 | True 56 | False 57 | 1 58 | 0 59 | 0 60 | 0 61 | False 62 | False 63 | False 64 | False 65 | False 66 | 1036 67 | 1252 68 | 69 | 70 | 71 | 72 | 1.0.0.0 73 | 74 | 75 | 76 | 77 | 78 | 1.0.0.0 79 | 80 | 81 | 82 | DCPdelphi2009.dpk 83 | 84 | 85 | 86 | 12 87 | 88 | 89 | 90 | MainSource 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | Base 126 | 127 | 128 | Cfg_2 129 | Base 130 | 131 | 132 | Cfg_1 133 | Base 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /DCPdelphi2009.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi2009.res -------------------------------------------------------------------------------- /DCPdelphi4.cfg: -------------------------------------------------------------------------------- 1 | -$A+ 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J+ 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 29 | -H+ 30 | -W+ 31 | -M 32 | -$M16384,1048576 33 | -K$00400000 34 | -LNc:\program files\borland\delphi4\Lib 35 | -Z 36 | -------------------------------------------------------------------------------- /DCPdelphi4.dof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi4.dof -------------------------------------------------------------------------------- /DCPdelphi4.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphi4; 2 | 3 | {$R *.RES} 4 | {$ALIGN ON} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST ON} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $00400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$DESIGNONLY} 27 | {$IMPLICITBUILD OFF} 28 | 29 | requires 30 | vcl40; 31 | 32 | contains 33 | DCPbase64 in 'DCPbase64.pas', 34 | DCPblockciphers in 'DCPblockciphers.pas', 35 | DCPconst in 'DCPconst.pas', 36 | DCPcrypt2 in 'DCPcrypt2.pas', 37 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 38 | DCPcast128 in 'Ciphers\DCPcast128.pas', 39 | DCPcast256 in 'Ciphers\DCPcast256.pas', 40 | DCPdes in 'Ciphers\DCPdes.pas', 41 | DCPgost in 'Ciphers\DCPgost.pas', 42 | DCPice in 'Ciphers\DCPice.pas', 43 | DCPidea in 'Ciphers\DCPidea.pas', 44 | DCPmars in 'Ciphers\DCPmars.pas', 45 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 46 | DCPrc2 in 'Ciphers\DCPrc2.pas', 47 | DCPrc4 in 'Ciphers\DCPrc4.pas', 48 | DCPrc5 in 'Ciphers\DCPrc5.pas', 49 | DCPrc6 in 'Ciphers\DCPrc6.pas', 50 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 51 | DCPtea in 'Ciphers\DCPtea.pas', 52 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 53 | DCPhaval in 'Hashes\DCPhaval.pas', 54 | DCPmd4 in 'Hashes\DCPmd4.pas', 55 | DCPmd5 in 'Hashes\DCPmd5.pas', 56 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 57 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 58 | DCPsha1 in 'Hashes\DCPsha1.pas', 59 | DCPtiger in 'Hashes\DCPtiger.pas', 60 | DCPreg in 'DCPreg.pas', 61 | DCPserpent in 'Ciphers\DCPserpent.pas', 62 | DCPsha256 in 'Hashes\DCPsha256.pas', 63 | DCPsha512 in 'Hashes\DCPsha512.pas'; 64 | 65 | end. 66 | -------------------------------------------------------------------------------- /DCPdelphi4.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi4.res -------------------------------------------------------------------------------- /DCPdelphi5.cfg: -------------------------------------------------------------------------------- 1 | -$A+ 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J+ 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 29 | -H+ 30 | -W+ 31 | -M 32 | -$M16384,1048576 33 | -K$00400000 34 | -LE"c:\program files\borland\delphi5\Projects\Bpl" 35 | -LN"c:\program files\borland\delphi5\Projects\Bpl" 36 | -Z 37 | -------------------------------------------------------------------------------- /DCPdelphi5.dof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi5.dof -------------------------------------------------------------------------------- /DCPdelphi5.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphi4; 2 | 3 | {$R *.RES} 4 | {$ALIGN ON} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST ON} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$DESIGNONLY} 27 | {$IMPLICITBUILD OFF} 28 | 29 | requires 30 | vcl50; 31 | 32 | contains 33 | DCPbase64 in 'DCPbase64.pas', 34 | DCPblockciphers in 'DCPblockciphers.pas', 35 | DCPconst in 'DCPconst.pas', 36 | DCPcrypt2 in 'DCPcrypt2.pas', 37 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 38 | DCPcast128 in 'Ciphers\DCPcast128.pas', 39 | DCPcast256 in 'Ciphers\DCPcast256.pas', 40 | DCPdes in 'Ciphers\DCPdes.pas', 41 | DCPgost in 'Ciphers\DCPgost.pas', 42 | DCPice in 'Ciphers\DCPice.pas', 43 | DCPidea in 'Ciphers\DCPidea.pas', 44 | DCPmars in 'Ciphers\DCPmars.pas', 45 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 46 | DCPrc2 in 'Ciphers\DCPrc2.pas', 47 | DCPrc4 in 'Ciphers\DCPrc4.pas', 48 | DCPrc5 in 'Ciphers\DCPrc5.pas', 49 | DCPrc6 in 'Ciphers\DCPrc6.pas', 50 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 51 | DCPtea in 'Ciphers\DCPtea.pas', 52 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 53 | DCPhaval in 'Hashes\DCPhaval.pas', 54 | DCPmd4 in 'Hashes\DCPmd4.pas', 55 | DCPmd5 in 'Hashes\DCPmd5.pas', 56 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 57 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 58 | DCPsha1 in 'Hashes\DCPsha1.pas', 59 | DCPtiger in 'Hashes\DCPtiger.pas', 60 | DCPreg in 'DCPreg.pas', 61 | DCPserpent in 'Ciphers\DCPserpent.pas', 62 | DCPsha256 in 'Hashes\DCPsha256.pas', 63 | DCPsha512 in 'Hashes\DCPsha512.pas'; 64 | 65 | end. 66 | -------------------------------------------------------------------------------- /DCPdelphi5.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi5.res -------------------------------------------------------------------------------- /DCPdelphi6.cfg: -------------------------------------------------------------------------------- 1 | -$A8 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J- 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 29 | -H+ 30 | -W+ 31 | -M 32 | -$M16384,1048576 33 | -K$00400000 34 | -LE"c:\program files\borland\delphi6\Projects\Bpl" 35 | -LN"c:\program files\borland\delphi6\Projects\Bpl" 36 | -Z 37 | -------------------------------------------------------------------------------- /DCPdelphi6.dof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi6.dof -------------------------------------------------------------------------------- /DCPdelphi6.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphi6; 2 | 3 | {$R *.res} 4 | {$ALIGN 8} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST OFF} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$DESIGNONLY} 27 | {$IMPLICITBUILD OFF} 28 | 29 | requires 30 | rtl; 31 | 32 | contains 33 | DCPbase64 in 'DCPbase64.pas', 34 | DCPblockciphers in 'DCPblockciphers.pas', 35 | DCPconst in 'DCPconst.pas', 36 | DCPcrypt2 in 'DCPcrypt2.pas', 37 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 38 | DCPcast128 in 'Ciphers\DCPcast128.pas', 39 | DCPcast256 in 'Ciphers\DCPcast256.pas', 40 | DCPdes in 'Ciphers\DCPdes.pas', 41 | DCPgost in 'Ciphers\DCPgost.pas', 42 | DCPice in 'Ciphers\DCPice.pas', 43 | DCPidea in 'Ciphers\DCPidea.pas', 44 | DCPmars in 'Ciphers\DCPmars.pas', 45 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 46 | DCPrc2 in 'Ciphers\DCPrc2.pas', 47 | DCPrc4 in 'Ciphers\DCPrc4.pas', 48 | DCPrc5 in 'Ciphers\DCPrc5.pas', 49 | DCPrc6 in 'Ciphers\DCPrc6.pas', 50 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 51 | DCPtea in 'Ciphers\DCPtea.pas', 52 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 53 | DCPhaval in 'Hashes\DCPhaval.pas', 54 | DCPmd4 in 'Hashes\DCPmd4.pas', 55 | DCPmd5 in 'Hashes\DCPmd5.pas', 56 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 57 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 58 | DCPsha1 in 'Hashes\DCPsha1.pas', 59 | DCPtiger in 'Hashes\DCPtiger.pas', 60 | DCPreg in 'DCPreg.pas', 61 | DCPserpent in 'Ciphers\DCPserpent.pas', 62 | DCPsha256 in 'Hashes\DCPsha256.pas', 63 | DCPsha512 in 'Hashes\DCPsha512.pas'; 64 | 65 | end. 66 | -------------------------------------------------------------------------------- /DCPdelphi6.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphi6.res -------------------------------------------------------------------------------- /DCPdelphiBerlin.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiBerlin; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiBerlin.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiBerlin.res -------------------------------------------------------------------------------- /DCPdelphiRio.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiRio; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiRio.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiRio.res -------------------------------------------------------------------------------- /DCPdelphiTokyo.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiTokyo; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiTokyo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiTokyo.res -------------------------------------------------------------------------------- /DCPdelphiXE.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE2; 2 | 3 | {$R *.res} 4 | {$ALIGN 8} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$DEFINITIONINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST OFF} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 26 | {$IMPLICITBUILD ON} 27 | 28 | requires 29 | rtl; 30 | 31 | contains 32 | DCPbase64 in 'DCPbase64.pas', 33 | DCPblockciphers in 'DCPblockciphers.pas', 34 | DCPconst in 'DCPconst.pas', 35 | DCPcrypt2 in 'DCPcrypt2.pas', 36 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 37 | DCPcast128 in 'Ciphers\DCPcast128.pas', 38 | DCPcast256 in 'Ciphers\DCPcast256.pas', 39 | DCPdes in 'Ciphers\DCPdes.pas', 40 | DCPgost in 'Ciphers\DCPgost.pas', 41 | DCPice in 'Ciphers\DCPice.pas', 42 | DCPidea in 'Ciphers\DCPidea.pas', 43 | DCPmars in 'Ciphers\DCPmars.pas', 44 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 45 | DCPrc2 in 'Ciphers\DCPrc2.pas', 46 | DCPrc4 in 'Ciphers\DCPrc4.pas', 47 | DCPrc5 in 'Ciphers\DCPrc5.pas', 48 | DCPrc6 in 'Ciphers\DCPrc6.pas', 49 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 50 | DCPtea in 'Ciphers\DCPtea.pas', 51 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 52 | DCPhaval in 'Hashes\DCPhaval.pas', 53 | DCPmd4 in 'Hashes\DCPmd4.pas', 54 | DCPmd5 in 'Hashes\DCPmd5.pas', 55 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 56 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 57 | DCPsha1 in 'Hashes\DCPsha1.pas', 58 | DCPtiger in 'Hashes\DCPtiger.pas', 59 | DCPreg in 'DCPreg.pas', 60 | DCPserpent in 'Ciphers\DCPserpent.pas', 61 | DCPsha256 in 'Hashes\DCPsha256.pas', 62 | DCPsha512 in 'Hashes\DCPsha512.pas'; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /DCPdelphiXE.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {ae9b70a6-b2c2-45a0-ba7b-2448a376d73f} 4 | DCPdelphiXE.dpk 5 | Debug 6 | DCC32 7 | C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl\DCPdelphi2009.bpl 8 | 12.3 9 | Release 10 | True 11 | Win32 12 | Package 13 | None 14 | 15 | 16 | true 17 | 18 | 19 | true 20 | Base 21 | true 22 | 23 | 24 | true 25 | Base 26 | true 27 | 28 | 29 | true 30 | WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias) 31 | 00400000 32 | C:\Documents and Settings\All Users\Documents\RAD Studio\6.0\Bpl\DCPdelphi2009.bpl 33 | DCPcrypt cryptographic component library v2 BETA 3 34 | true 35 | true 36 | 1 37 | 38 | 39 | .\x86 40 | 7.0 41 | False 42 | False 43 | 0 44 | RELEASE;$(DCC_Define) 45 | 46 | 47 | 7.0 48 | 49 | 50 | Delphi.Personality.12 51 | Package 52 | 53 | 54 | 55 | 56 | True 57 | False 58 | 1 59 | 0 60 | 0 61 | 0 62 | False 63 | False 64 | False 65 | False 66 | False 67 | 1036 68 | 1252 69 | 70 | 71 | 72 | 73 | 1.0.0.0 74 | 75 | 76 | 77 | 78 | 79 | 1.0.0.0 80 | 81 | 82 | 83 | DCPdelphiXE.dpk 84 | 85 | 86 | 87 | True 88 | 89 | 90 | 12 91 | 92 | 93 | 94 | MainSource 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | Cfg_2 130 | Base 131 | 132 | 133 | Base 134 | 135 | 136 | Cfg_1 137 | Base 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /DCPdelphiXE.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE.res -------------------------------------------------------------------------------- /DCPdelphiXE10.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE10; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiXE10.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE10.res -------------------------------------------------------------------------------- /DCPdelphiXE2.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE2; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas'; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /DCPdelphiXE2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE2.res -------------------------------------------------------------------------------- /DCPdelphiXE3.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE3; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas'; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /DCPdelphiXE3.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE3.res -------------------------------------------------------------------------------- /DCPdelphiXE4.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE4; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas'; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /DCPdelphiXE4.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE4.res -------------------------------------------------------------------------------- /DCPdelphiXE5.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE5; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiXE5.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE5.res -------------------------------------------------------------------------------- /DCPdelphiXE6.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE6; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiXE6.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE6.res -------------------------------------------------------------------------------- /DCPdelphiXE7.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE7; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiXE7.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE7.res -------------------------------------------------------------------------------- /DCPdelphiXE8.dpk: -------------------------------------------------------------------------------- 1 | package DCPdelphiXE8; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS OFF} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION ON} 16 | {$OVERFLOWCHECKS OFF} 17 | {$RANGECHECKS OFF} 18 | {$REFERENCEINFO OFF} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES OFF} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE RELEASE} 27 | {$ENDIF IMPLICITBUILDING} 28 | {$DESCRIPTION 'DCPcrypt cryptographic component library v2 BETA 3'} 29 | {$IMPLICITBUILD ON} 30 | 31 | requires 32 | rtl; 33 | 34 | contains 35 | DCPbase64 in 'DCPbase64.pas', 36 | DCPblockciphers in 'DCPblockciphers.pas', 37 | DCPconst in 'DCPconst.pas', 38 | DCPcrypt2 in 'DCPcrypt2.pas', 39 | DCPblowfish in 'Ciphers\DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers\DCPcast128.pas', 41 | DCPcast256 in 'Ciphers\DCPcast256.pas', 42 | DCPdes in 'Ciphers\DCPdes.pas', 43 | DCPgost in 'Ciphers\DCPgost.pas', 44 | DCPice in 'Ciphers\DCPice.pas', 45 | DCPidea in 'Ciphers\DCPidea.pas', 46 | DCPmars in 'Ciphers\DCPmars.pas', 47 | DCPmisty1 in 'Ciphers\DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers\DCPrc2.pas', 49 | DCPrc4 in 'Ciphers\DCPrc4.pas', 50 | DCPrc5 in 'Ciphers\DCPrc5.pas', 51 | DCPrc6 in 'Ciphers\DCPrc6.pas', 52 | DCPrijndael in 'Ciphers\DCPrijndael.pas', 53 | DCPtea in 'Ciphers\DCPtea.pas', 54 | DCPtwofish in 'Ciphers\DCPtwofish.pas', 55 | DCPhaval in 'Hashes\DCPhaval.pas', 56 | DCPmd4 in 'Hashes\DCPmd4.pas', 57 | DCPmd5 in 'Hashes\DCPmd5.pas', 58 | DCPripemd128 in 'Hashes\DCPripemd128.pas', 59 | DCPripemd160 in 'Hashes\DCPripemd160.pas', 60 | DCPsha1 in 'Hashes\DCPsha1.pas', 61 | DCPtiger in 'Hashes\DCPtiger.pas', 62 | DCPreg in 'DCPreg.pas', 63 | DCPserpent in 'Ciphers\DCPserpent.pas', 64 | DCPsha256 in 'Hashes\DCPsha256.pas', 65 | DCPsha512 in 'Hashes\DCPsha512.pas', 66 | DCPtypes in 'DCPtypes.pas'; 67 | 68 | end. 69 | -------------------------------------------------------------------------------- /DCPdelphiXE8.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPdelphiXE8.res -------------------------------------------------------------------------------- /DCPhashes.dcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPhashes.dcr -------------------------------------------------------------------------------- /DCPkylix.conf: -------------------------------------------------------------------------------- 1 | -$A8 2 | -$B- 3 | -$C+ 4 | -$D+ 5 | -$E- 6 | -$F- 7 | -$G+ 8 | -$H+ 9 | -$I+ 10 | -$J- 11 | -$K- 12 | -$L+ 13 | -$M- 14 | -$N+ 15 | -$O+ 16 | -$P+ 17 | -$Q- 18 | -$R- 19 | -$S- 20 | -$T- 21 | -$U- 22 | -$V+ 23 | -$W- 24 | -$X+ 25 | -$YD 26 | -$Z1 27 | -cg 28 | -H+ 29 | -W+ 30 | -M 31 | -$M16384,1048576 32 | -K$00400000 33 | -Z 34 | -------------------------------------------------------------------------------- /DCPkylix.dpk: -------------------------------------------------------------------------------- 1 | package DCPkylix; 2 | 3 | {$R *.res} 4 | {$ALIGN 8} 5 | {$ASSERTIONS ON} 6 | {$BOOLEVAL OFF} 7 | {$DEBUGINFO ON} 8 | {$EXTENDEDSYNTAX ON} 9 | {$IMPORTEDDATA ON} 10 | {$IOCHECKS ON} 11 | {$LOCALSYMBOLS ON} 12 | {$LONGSTRINGS ON} 13 | {$OPENSTRINGS ON} 14 | {$OPTIMIZATION ON} 15 | {$OVERFLOWCHECKS OFF} 16 | {$RANGECHECKS OFF} 17 | {$REFERENCEINFO ON} 18 | {$SAFEDIVIDE OFF} 19 | {$STACKFRAMES OFF} 20 | {$TYPEDADDRESS OFF} 21 | {$VARSTRINGCHECKS ON} 22 | {$WRITEABLECONST OFF} 23 | {$MINENUMSIZE 1} 24 | {$IMAGEBASE $400000} 25 | {$DESCRIPTION 'DCPcrypt cryptographic components library v2 BETA 3'} 26 | {$DESIGNONLY} 27 | {$IMPLICITBUILD OFF} 28 | 29 | requires 30 | baseclx, 31 | visualclx; 32 | 33 | contains 34 | DCPbase64 in 'DCPbase64.pas', 35 | DCPblockciphers in 'DCPblockciphers.pas', 36 | DCPconst in 'DCPconst.pas', 37 | DCPcrypt2 in 'DCPcrypt2.pas', 38 | DCPreg in 'DCPreg.pas', 39 | DCPblowfish in 'Ciphers/DCPblowfish.pas', 40 | DCPcast128 in 'Ciphers/DCPcast128.pas', 41 | DCPcast256 in 'Ciphers/DCPcast256.pas', 42 | DCPdes in 'Ciphers/DCPdes.pas', 43 | DCPgost in 'Ciphers/DCPgost.pas', 44 | DCPice in 'Ciphers/DCPice.pas', 45 | DCPidea in 'Ciphers/DCPidea.pas', 46 | DCPmars in 'Ciphers/DCPmars.pas', 47 | DCPmisty1 in 'Ciphers/DCPmisty1.pas', 48 | DCPrc2 in 'Ciphers/DCPrc2.pas', 49 | DCPrc4 in 'Ciphers/DCPrc4.pas', 50 | DCPrc5 in 'Ciphers/DCPrc5.pas', 51 | DCPrc6 in 'Ciphers/DCPrc6.pas', 52 | DCPrijndael in 'Ciphers/DCPrijndael.pas', 53 | DCPserpent in 'Ciphers/DCPserpent.pas', 54 | DCPtea in 'Ciphers/DCPtea.pas', 55 | DCPtwofish in 'Ciphers/DCPtwofish.pas', 56 | DCPhaval in 'Hashes/DCPhaval.pas', 57 | DCPmd4 in 'Hashes/DCPmd4.pas', 58 | DCPmd5 in 'Hashes/DCPmd5.pas', 59 | DCPripemd128 in 'Hashes/DCPripemd128.pas', 60 | DCPripemd160 in 'Hashes/DCPripemd160.pas', 61 | DCPsha1 in 'Hashes/DCPsha1.pas', 62 | DCPsha256 in 'Hashes/DCPsha256.pas', 63 | DCPsha512 in 'Hashes/DCPsha512.pas', 64 | DCPtiger in 'Hashes/DCPtiger.pas'; 65 | 66 | end. 67 | -------------------------------------------------------------------------------- /DCPkylix.kof: -------------------------------------------------------------------------------- 1 | [Compiler] 2 | A=8 3 | B=0 4 | C=1 5 | D=1 6 | E=0 7 | F=0 8 | G=1 9 | H=1 10 | I=1 11 | J=0 12 | K=0 13 | L=1 14 | M=0 15 | N=1 16 | O=1 17 | P=1 18 | Q=0 19 | R=0 20 | S=0 21 | T=0 22 | U=0 23 | V=1 24 | W=0 25 | X=1 26 | Y=1 27 | Z=1 28 | ShowHints=1 29 | ShowWarnings=1 30 | UnitAliases= 31 | 32 | [Linker] 33 | MapFile=0 34 | OutputObjs=0 35 | ConsoleApp=1 36 | DebugInfo=0 37 | RemoteSymbols=0 38 | MinStackSize=16384 39 | MaxStackSize=1048576 40 | ImageBase=4194304 41 | ExeDescription=DCPcrypt cryptographic components library v2 BETA 3 42 | DynamicLoader=/lib/ld-linux.so.2 43 | 44 | [Directories] 45 | OutputDir= 46 | UnitOutputDir= 47 | PackageDLLOutputDir= 48 | PackageDCPOutputDir= 49 | SearchPath= 50 | Packages=baseclx:visualclx 51 | Conditionals= 52 | DebugSourceDirs= 53 | UsePackages=0 54 | 55 | [Parameters] 56 | RunParams= 57 | HostApplication= 58 | Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee% 59 | UseLauncher=0 60 | DebugCWD= 61 | 62 | -------------------------------------------------------------------------------- /DCPkylix.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/DCPkylix.res -------------------------------------------------------------------------------- /DCPreg.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* Component registration for DCPcrypt ****************************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPreg; 26 | 27 | interface 28 | uses 29 | Classes; 30 | 31 | procedure Register; 32 | 33 | implementation 34 | uses 35 | DCPcrypt2, DCPblockciphers, DCPconst, DCPblowfish, DCPcast128, DCPcast256, 36 | DCPdes, DCPgost, DCPice, DCPidea, DCPmars, DCPmisty1, DCPrc2, DCPrc4, DCPrc5, 37 | DCPrc6, DCPrijndael, DCPserpent, DCPtea, DCPtwofish, 38 | DCPhaval, DCPmd4, DCPmd5, DCPripemd128, DCPripemd160, DCPsha1, DCPsha256, 39 | DCPsha512, DCPtiger; 40 | 41 | {$R DCPciphers.dcr} 42 | {$R DCPhashes.dcr} 43 | 44 | procedure Register; 45 | begin 46 | RegisterComponents(DCPcipherpage,[TDCP_blowfish,TDCP_cast128,TDCP_cast256, 47 | TDCP_des,TDCP_3des,{TDCP_gost,}TDCP_ice,TDCP_thinice,TDCP_ice2,TDCP_idea, 48 | TDCP_mars,TDCP_misty1,TDCP_rc2,TDCP_rc4,TDCP_rc5,TDCP_rc6,TDCP_rijndael, 49 | TDCP_serpent,TDCP_tea,TDCP_twofish]); 50 | RegisterComponents(DCPhashpage,[TDCP_haval,TDCP_md4,TDCP_md5,TDCP_ripemd128, 51 | TDCP_ripemd160,TDCP_sha1,TDCP_sha256,TDCP_sha384,TDCP_sha512,TDCP_tiger]); 52 | end; 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /DCPtypes.pas: -------------------------------------------------------------------------------- 1 | unit DCPtypes; 2 | 3 | {$I DCP.inc} 4 | 5 | interface 6 | 7 | uses 8 | Classes, SysUtils; 9 | 10 | {$IFDEF NEXTGEN} 11 | type 12 | AnsiString = record 13 | private type 14 | TDisposer = class 15 | private 16 | FInline: array[0..3] of Pointer; 17 | FOverflow: TArray; 18 | FCount: Integer; 19 | procedure AddDispose(P: Pointer); 20 | procedure Flush; 21 | public 22 | destructor Destroy; override; 23 | end; 24 | 25 | private 26 | FPtr: MarshaledAString; 27 | FLength: integer; 28 | FDisposer: TDisposer; 29 | 30 | procedure AddDispose(P: Pointer); 31 | function GetChars(Index: Integer): MarshaledAString; inline; 32 | procedure SetChars(Index: Integer; Value: MarshaledAString); inline; 33 | procedure SetPtr(Value: MarshaledAString); 34 | public 35 | procedure SetLength(NewLength: integer); 36 | function Length: integer; inline; 37 | 38 | class operator Equal(const Left, Right: AnsiString): Boolean; 39 | class operator NotEqual(const Left, Right: AnsiString): Boolean; inline; 40 | 41 | class operator Implicit(const Val: AnsiString): MarshaledAString; 42 | class operator Explicit(const Ptr: MarshaledAString): AnsiString; 43 | 44 | class operator Implicit(const Val: AnsiString): string; 45 | class operator Implicit(const Str: string): AnsiString; 46 | 47 | class operator Implicit(const Val: AnsiString): Variant; 48 | class operator Explicit(const v: Variant): AnsiString; 49 | 50 | class operator Implicit(const Val: AnsiString): TBytes; 51 | class operator Explicit(const b: TBytes): AnsiString; 52 | 53 | property Chars[index: Integer]: MarshaledAString read GetChars write SetChars; default; 54 | property Ptr: MarshaledAString read FPtr write SetPtr; 55 | end; 56 | 57 | WideString = string; 58 | 59 | AnsiChar = byte; 60 | PAnsiChar = MarshaledAString; 61 | {$ENDIF NEXTGEN} 62 | 63 | implementation 64 | 65 | {$IFDEF NEXTGEN} 66 | uses 67 | Math; 68 | {$ENDIF} 69 | 70 | {$IFDEF NEXTGEN} 71 | 72 | { AnsiString.TDisposer } 73 | 74 | destructor AnsiString.TDisposer.Destroy; 75 | begin 76 | Flush; 77 | inherited; 78 | end; 79 | 80 | procedure AnsiString.TDisposer.AddDispose(P: Pointer); 81 | var 82 | c: Integer; 83 | begin 84 | if FCount < System.Length(FInline) then 85 | FInline[FCount] := P 86 | else begin 87 | c := FCount - System.Length(FInline); 88 | if c = System.Length(FOverflow) then begin 89 | if System.Length(FOverflow) < 4 then 90 | System.SetLength(FOverflow, 4) 91 | else 92 | System.SetLength(FOverflow, System.Length(FOverflow) * 2); 93 | end; 94 | FOverflow[c] := P; 95 | end; 96 | 97 | Inc(FCount); 98 | end; 99 | 100 | procedure AnsiString.TDisposer.Flush; 101 | var 102 | i: Integer; 103 | begin 104 | if FCount <= System.Length(FInline) then begin 105 | for i := 0 to FCount - 1 do 106 | System.FreeMem(FInline[i]); 107 | end 108 | else begin 109 | for i := 0 to System.Length(FInline) - 1 do 110 | System.FreeMem(FInline[i]); 111 | for i := 0 to FCount - System.Length(FInline) - 1 do 112 | System.FreeMem(FOverflow[i]); 113 | end; 114 | FCount := 0; 115 | System.SetLength(FOverflow, 0); 116 | end; 117 | 118 | { AnsiString } 119 | 120 | procedure AnsiString.AddDispose(P: Pointer); 121 | begin 122 | if FDisposer = nil then 123 | FDisposer := TDisposer.Create; 124 | FDisposer.AddDispose(P); 125 | end; 126 | 127 | procedure AnsiString.SetLength(NewLength: integer); 128 | var 129 | NewPtr: Pointer; 130 | begin 131 | if NewLength <= 0 then begin 132 | FPtr := nil; 133 | FLength := 0; 134 | Exit; 135 | end; 136 | 137 | NewPtr := System.AllocMem(NewLength + 1); 138 | if (FDisposer <> nil) and (FPtr <> nil) then 139 | Move(FPtr^, NewPtr^, Min(FLength, NewLength)); 140 | 141 | AddDispose(NewPtr); 142 | FPtr := NewPtr; 143 | FPtr[NewLength] := #0; 144 | FLength := NewLength; 145 | end; 146 | 147 | function AnsiString.Length: integer; 148 | begin 149 | if (FDisposer <> nil) and (FPtr <> nil) then 150 | Result := FLength 151 | else 152 | Result := 0; 153 | end; 154 | 155 | class operator AnsiString.Equal(const Left, Right: AnsiString): Boolean; 156 | var 157 | Len: integer; 158 | P1, P2: PAnsiChar; 159 | begin 160 | Len := Left.Length; 161 | Result := Len = Right.Length; 162 | if Result then begin 163 | P1 := Left.FPtr; 164 | P2 := Right.Ptr; 165 | while Len > 0 do begin 166 | if P1^ <> P2^ then 167 | Exit(False); 168 | Inc(P1); 169 | Inc(P2); 170 | Dec(Len); 171 | end; 172 | end; 173 | end; 174 | 175 | class operator AnsiString.NotEqual(const Left, Right: AnsiString): Boolean; 176 | begin 177 | Result := not (Left = Right); 178 | end; 179 | 180 | class operator AnsiString.Implicit(const Val: AnsiString): MarshaledAString; 181 | begin 182 | if Val.FPtr = nil then 183 | Result := #0 184 | else 185 | Result := Val.FPtr; 186 | end; 187 | 188 | class operator AnsiString.Explicit(const Ptr: MarshaledAString): AnsiString; 189 | begin 190 | if Result.FPtr <> Ptr then begin 191 | Result.FLength := System.Length(Ptr); 192 | 193 | if Result.FLength = 0 then 194 | Result.FPtr := nil 195 | else begin 196 | Result.FPtr := System.AllocMem(Result.FLength + 1); 197 | Result.AddDispose(Result.FPtr); 198 | 199 | Move(Ptr^, Result.FPtr^, Result.FLength); 200 | Result.FPtr[Result.FLength] := #0; 201 | end; 202 | end; 203 | end; 204 | 205 | class operator AnsiString.Implicit(const Val: AnsiString): string; 206 | begin 207 | Result := string(Val.FPtr); 208 | end; 209 | 210 | class operator AnsiString.Implicit(const Str: string): AnsiString; 211 | begin 212 | Result.FLength := LocaleCharsFromUnicode(DefaultSystemCodePage, 0, PWideChar(Str), System.Length(Str) + 1, nil, 0, nil, nil); 213 | if Result.FLength > 0 then begin 214 | Result.FPtr := System.AllocMem(Result.FLength); 215 | Result.AddDispose(Result.FPtr); 216 | LocaleCharsFromUnicode(DefaultSystemCodePage, 0, PWideChar(Str), System.Length(Str) + 1, 217 | Result.FPtr, Result.FLength, nil, nil); 218 | Dec(Result.FLength); 219 | end 220 | else 221 | Result.FPtr := nil; 222 | end; 223 | 224 | class operator AnsiString.Implicit(const Val: AnsiString): Variant; 225 | begin 226 | Result := string(Val.FPtr); 227 | end; 228 | 229 | class operator AnsiString.Explicit(const v: Variant): AnsiString; 230 | begin 231 | Result := AnsiString(string(v)); 232 | end; 233 | 234 | class operator AnsiString.Implicit(const Val: AnsiString): TBytes; 235 | var 236 | Len: integer; 237 | begin 238 | Len := Val.Length; 239 | System.SetLength(Result, Len); 240 | if Len > 0 then 241 | Move(Val.FPtr^, Result[0], Len); 242 | end; 243 | 244 | class operator AnsiString.Explicit(const b: TBytes): AnsiString; 245 | begin 246 | Result.FLength := System.Length(b); 247 | 248 | if Result.FLength = 0 then 249 | Result.FPtr := nil 250 | else begin 251 | Result.FPtr := System.AllocMem(Result.FLength + 1); 252 | Result.AddDispose(Result.FPtr); 253 | 254 | Move(b[0], Result.FPtr^, Result.FLength); 255 | Result.FPtr[Result.FLength] := #0; 256 | end; 257 | end; 258 | 259 | function AnsiString.GetChars(Index: Integer): MarshaledAString; 260 | begin 261 | Result := @FPtr[Index - 1]; 262 | end; 263 | 264 | procedure AnsiString.SetChars(Index: Integer; Value: MarshaledAString); 265 | begin 266 | FPtr[Index - 1] := Value[0]; 267 | end; 268 | 269 | procedure AnsiString.SetPtr(Value: MarshaledAString); 270 | begin 271 | if FDisposer = nil then 272 | FDisposer := TDisposer.Create; 273 | 274 | FPtr := Value; 275 | FLength := System.Length(Value); 276 | end; 277 | 278 | {$ENDIF} 279 | 280 | end. 281 | -------------------------------------------------------------------------------- /Demos/FileEncrypt/FileEncrypt.dpr: -------------------------------------------------------------------------------- 1 | program FileEncrypt; 2 | 3 | uses 4 | Forms, 5 | uMain in 'uMain.pas' {frmMain}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.CreateForm(TfrmMain, frmMain); 12 | Application.Run; 13 | end. 14 | -------------------------------------------------------------------------------- /Demos/FileEncrypt/FileEncrypt.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {986FD9F6-2061-4F9F-8320-8CD861AC6D8F} 4 | FileEncrypt.dpr 5 | True 6 | Release 7 | 3 8 | Application 9 | VCL 10 | 13.4 11 | Win64 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Cfg_1 40 | true 41 | true 42 | 43 | 44 | true 45 | Base 46 | true 47 | 48 | 49 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 50 | 1049 51 | Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace) 52 | 00400000 53 | false 54 | false 55 | false 56 | false 57 | false 58 | 59 | 60 | System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) 61 | FileEncrypt_Icon.ico 62 | true 63 | 1033 64 | $(BDS)\bin\default_app.manifest 65 | 66 | 67 | true 68 | FileEncrypt_Icon.ico 69 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 70 | 1033 71 | $(BDS)\bin\default_app.manifest 72 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 73 | 74 | 75 | false 76 | false 77 | 0 78 | RELEASE;$(DCC_Define) 79 | 80 | 81 | true 82 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\FileEncrypt_Icon.ico 83 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x64\ 84 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x64\ 85 | 1033 86 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x64\ 87 | 88 | 89 | true 90 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\FileEncrypt_Icon.ico 91 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x86\ 92 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x86\ 93 | 1033 94 | $(BDS)\Neo\DCPcrypt\Demos\FileEncrypt\x86\ 95 | 96 | 97 | DEBUG;$(DCC_Define) 98 | false 99 | true 100 | 101 | 102 | 103 | MainSource 104 | 105 | 106 |
frmMain
107 |
108 | 109 | Cfg_2 110 | Base 111 | 112 | 113 | Base 114 | 115 | 116 | Cfg_1 117 | Base 118 | 119 |
120 | 121 | Delphi.Personality.12 122 | 123 | 124 | 125 | 126 | FileEncrypt.dpr 127 | 128 | 129 | False 130 | False 131 | 1 132 | 0 133 | 0 134 | 0 135 | False 136 | False 137 | False 138 | False 139 | False 140 | 1049 141 | 1251 142 | 143 | 144 | 145 | 146 | 1.0.0.0 147 | 148 | 149 | 150 | 151 | 152 | 1.0.0.0 153 | 154 | 155 | 156 | Embarcadero C++Builder Office 2000 Servers Package 157 | Embarcadero C++Builder Office XP Servers Package 158 | Microsoft Office 2000 Sample Automation Server Wrapper Components 159 | Microsoft Office XP Sample Automation Server Wrapper Components 160 | 161 | 162 | 163 | True 164 | True 165 | 166 | 167 | 12 168 | 169 | 170 | 171 |
172 | -------------------------------------------------------------------------------- /Demos/FileEncrypt/FileEncrypt.identcache: -------------------------------------------------------------------------------- 1 | ZC:\Program Files\Embarcadero\RAD Studio\9.0\Neo\DCPcrypt\Demos\FileEncrypt\FileEncrypt.dprTC:\Program Files\Embarcadero\RAD Studio\9.0\Neo\DCPcrypt\Demos\FileEncrypt\uMain.pas -------------------------------------------------------------------------------- /Demos/FileEncrypt/FileEncrypt.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/Demos/FileEncrypt/FileEncrypt.res -------------------------------------------------------------------------------- /Demos/FileEncrypt/FileEncrypt_Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/Demos/FileEncrypt/FileEncrypt_Icon.ico -------------------------------------------------------------------------------- /Demos/FileHash/FileHash.dpr: -------------------------------------------------------------------------------- 1 | program FileHash; 2 | 3 | uses 4 | Forms, 5 | uMain in 'uMain.pas' {frmMain}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.CreateForm(TfrmMain, frmMain); 12 | Application.Run; 13 | end. 14 | -------------------------------------------------------------------------------- /Demos/FileHash/FileHash.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {5BA5D14A-6176-4D91-A652-F1239E46C5D9} 4 | FileHash.dpr 5 | True 6 | Debug 7 | Win32 8 | Application 9 | VCL 10 | DCC32 11 | 12.3 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | false 28 | 00400000 29 | WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias) 30 | false 31 | false 32 | false 33 | false 34 | 35 | 36 | false 37 | RELEASE;$(DCC_Define) 38 | 0 39 | false 40 | 41 | 42 | DEBUG;$(DCC_Define) 43 | false 44 | true 45 | 46 | 47 | 48 | MainSource 49 | 50 | 51 |
frmMain
52 |
53 | 54 | Cfg_2 55 | Base 56 | 57 | 58 | Base 59 | 60 | 61 | Cfg_1 62 | Base 63 | 64 |
65 | 66 | 67 | 68 | Delphi.Personality.12 69 | VCLApplication 70 | 71 | 72 | 73 | FileHash.dpr 74 | 75 | 76 | False 77 | False 78 | 1 79 | 0 80 | 0 81 | 0 82 | False 83 | False 84 | False 85 | False 86 | False 87 | 1049 88 | 1251 89 | 90 | 91 | 92 | 93 | 1.0.0.0 94 | 95 | 96 | 97 | 98 | 99 | 1.0.0.0 100 | 101 | 102 | 103 | 104 | True 105 | 106 | 107 | 12 108 | 109 |
110 | -------------------------------------------------------------------------------- /Demos/FileHash/FileHash.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/Demos/FileHash/FileHash.res -------------------------------------------------------------------------------- /Demos/FileHash/uMain.dfm: -------------------------------------------------------------------------------- 1 | object frmMain: TfrmMain 2 | Left = 224 3 | Top = 110 4 | Width = 416 5 | Height = 450 6 | BorderIcons = [biSystemMenu, biMinimize] 7 | Caption = 'DCPcrypt File Hashing Demo' 8 | Color = clBtnFace 9 | Font.Charset = ANSI_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -13 12 | Font.Name = 'Arial' 13 | Font.Style = [] 14 | OldCreateOrder = False 15 | OnCreate = FormCreate 16 | DesignSize = ( 17 | 408 18 | 416) 19 | PixelsPerInch = 96 20 | TextHeight = 16 21 | object grpInputFile: TGroupBox 22 | Left = 8 23 | Top = 8 24 | Width = 393 25 | Height = 57 26 | Anchors = [akLeft, akTop, akRight] 27 | Caption = 'Input File' 28 | TabOrder = 0 29 | DesignSize = ( 30 | 393 31 | 57) 32 | object btnBrowseFiles: TSpeedButton 33 | Left = 360 34 | Top = 24 35 | Width = 24 36 | Height = 24 37 | Anchors = [akTop, akRight] 38 | Glyph.Data = { 39 | 76010000424D7601000000000000760000002800000020000000100000000100 40 | 04000000000000010000120B0000120B00001000000000000000000000000000 41 | 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000 42 | FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00555555555555 43 | 5555555555555555555555555555555555555555555555555555555555555555 44 | 555555555555555555555555555555555555555FFFFFFFFFF555550000000000 45 | 55555577777777775F55500B8B8B8B8B05555775F555555575F550F0B8B8B8B8 46 | B05557F75F555555575F50BF0B8B8B8B8B0557F575FFFFFFFF7F50FBF0000000 47 | 000557F557777777777550BFBFBFBFB0555557F555555557F55550FBFBFBFBF0 48 | 555557F555555FF7555550BFBFBF00055555575F555577755555550BFBF05555 49 | 55555575FFF75555555555700007555555555557777555555555555555555555 50 | 5555555555555555555555555555555555555555555555555555} 51 | NumGlyphs = 2 52 | OnClick = btnBrowseFilesClick 53 | end 54 | object boxInputFile: TEdit 55 | Left = 8 56 | Top = 24 57 | Width = 345 58 | Height = 24 59 | Anchors = [akLeft, akTop, akRight] 60 | TabOrder = 0 61 | end 62 | end 63 | object grpHashes: TGroupBox 64 | Left = 8 65 | Top = 72 66 | Width = 393 67 | Height = 153 68 | Anchors = [akLeft, akTop, akRight] 69 | Caption = 'Hashes' 70 | TabOrder = 1 71 | DesignSize = ( 72 | 393 73 | 153) 74 | object lstHashes: TCheckListBox 75 | Left = 8 76 | Top = 24 77 | Width = 289 78 | Height = 121 79 | Anchors = [akLeft, akTop, akRight] 80 | ItemHeight = 16 81 | Sorted = True 82 | TabOrder = 0 83 | end 84 | object btnHash: TButton 85 | Left = 304 86 | Top = 120 87 | Width = 81 88 | Height = 25 89 | Anchors = [akTop, akRight] 90 | Caption = 'Hash Files' 91 | TabOrder = 1 92 | OnClick = btnHashClick 93 | end 94 | end 95 | object grpOutput: TGroupBox 96 | Left = 8 97 | Top = 232 98 | Width = 393 99 | Height = 177 100 | Anchors = [akLeft, akTop, akRight, akBottom] 101 | Caption = 'Output' 102 | TabOrder = 2 103 | DesignSize = ( 104 | 393 105 | 177) 106 | object txtOutput: TMemo 107 | Left = 8 108 | Top = 24 109 | Width = 377 110 | Height = 145 111 | Anchors = [akLeft, akTop, akRight, akBottom] 112 | Font.Charset = ANSI_CHARSET 113 | Font.Color = clWindowText 114 | Font.Height = -13 115 | Font.Name = 'Courier New' 116 | Font.Style = [] 117 | ParentFont = False 118 | ReadOnly = True 119 | ScrollBars = ssBoth 120 | TabOrder = 0 121 | end 122 | end 123 | object DCP_haval1: TDCP_haval 124 | Id = 14 125 | Algorithm = 'Haval (256bit, 5 passes)' 126 | HashSize = 256 127 | Left = 24 128 | Top = 104 129 | end 130 | object DCP_md41: TDCP_md4 131 | Id = 17 132 | Algorithm = 'MD4' 133 | HashSize = 128 134 | Left = 56 135 | Top = 104 136 | end 137 | object DCP_md51: TDCP_md5 138 | Id = 16 139 | Algorithm = 'MD5' 140 | HashSize = 128 141 | Left = 88 142 | Top = 104 143 | end 144 | object DCP_ripemd1281: TDCP_ripemd128 145 | Id = 27 146 | Algorithm = 'RipeMD-128' 147 | HashSize = 128 148 | Left = 120 149 | Top = 104 150 | end 151 | object DCP_ripemd1601: TDCP_ripemd160 152 | Id = 10 153 | Algorithm = 'RipeMD-160' 154 | HashSize = 160 155 | Left = 152 156 | Top = 104 157 | end 158 | object DCP_sha11: TDCP_sha1 159 | Id = 2 160 | Algorithm = 'SHA1' 161 | HashSize = 160 162 | Left = 24 163 | Top = 136 164 | end 165 | object DCP_sha2561: TDCP_sha256 166 | Id = 28 167 | Algorithm = 'SHA256' 168 | HashSize = 256 169 | Left = 56 170 | Top = 136 171 | end 172 | object DCP_sha3841: TDCP_sha384 173 | Id = 29 174 | Algorithm = 'SHA384' 175 | HashSize = 384 176 | Left = 88 177 | Top = 136 178 | end 179 | object DCP_sha5121: TDCP_sha512 180 | Id = 30 181 | Algorithm = 'SHA512' 182 | HashSize = 512 183 | Left = 120 184 | Top = 136 185 | end 186 | object DCP_tiger1: TDCP_tiger 187 | Id = 18 188 | Algorithm = 'Tiger' 189 | HashSize = 192 190 | Left = 152 191 | Top = 136 192 | end 193 | object dlgOpen: TOpenDialog 194 | Filter = 'All Files (*.*)|*.*' 195 | Title = 'Choose input file' 196 | Left = 24 197 | Top = 168 198 | end 199 | end 200 | -------------------------------------------------------------------------------- /Demos/FileHash/uMain.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A file hashing demo ********************************************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 2003 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit uMain; 26 | 27 | interface 28 | 29 | uses 30 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 31 | Dialogs, Buttons, StdCtrls, CheckLst, DCPtiger, DCPsha512, DCPsha256, 32 | DCPsha1, DCPripemd160, DCPripemd128, DCPmd5, DCPmd4, DCPcrypt2, DCPhaval; 33 | 34 | type 35 | TfrmMain = class(TForm) 36 | DCP_haval1: TDCP_haval; 37 | DCP_md41: TDCP_md4; 38 | DCP_md51: TDCP_md5; 39 | DCP_ripemd1281: TDCP_ripemd128; 40 | DCP_ripemd1601: TDCP_ripemd160; 41 | DCP_sha11: TDCP_sha1; 42 | DCP_sha2561: TDCP_sha256; 43 | DCP_sha3841: TDCP_sha384; 44 | DCP_sha5121: TDCP_sha512; 45 | DCP_tiger1: TDCP_tiger; 46 | grpInputFile: TGroupBox; 47 | boxInputFile: TEdit; 48 | grpHashes: TGroupBox; 49 | lstHashes: TCheckListBox; 50 | grpOutput: TGroupBox; 51 | txtOutput: TMemo; 52 | btnHash: TButton; 53 | btnBrowseFiles: TSpeedButton; 54 | dlgOpen: TOpenDialog; 55 | procedure FormCreate(Sender: TObject); 56 | procedure btnBrowseFilesClick(Sender: TObject); 57 | procedure btnHashClick(Sender: TObject); 58 | private 59 | { Private declarations } 60 | public 61 | { Public declarations } 62 | end; 63 | 64 | var 65 | frmMain: TfrmMain; 66 | 67 | implementation 68 | 69 | {$R *.dfm} 70 | 71 | procedure TfrmMain.FormCreate(Sender: TObject); 72 | var 73 | i: integer; 74 | Hash: TDCP_hash; 75 | begin 76 | ClientHeight := 416; 77 | ClientWidth := 408; 78 | MessageDlg('This is a file hashing demo using the DCPcrypt component set.'+#13+'For more information see http://www.cityinthesky.co.uk/cryptography.html',mtInformation,[mbOK],0); 79 | 80 | // find all the hash algorithms on the form 81 | for i := 0 to ComponentCount - 1 do 82 | begin 83 | if Components[i] is TDCP_hash then 84 | begin 85 | Hash := TDCP_hash(Components[i]); 86 | lstHashes.Items.AddObject(Hash.Algorithm + ' (Digest size: ' + IntToStr(Hash.HashSize) + ' bits)',Components[i]); 87 | end; 88 | end; 89 | end; 90 | 91 | procedure TfrmMain.btnBrowseFilesClick(Sender: TObject); 92 | begin 93 | if dlgOpen.Execute then 94 | boxInputFile.Text := dlgOpen.FileName; 95 | end; 96 | 97 | procedure TfrmMain.btnHashClick(Sender: TObject); 98 | var 99 | Hashes: array of TDCP_hash; 100 | HashDigest: array of byte; 101 | i, j, read: integer; 102 | s: string; 103 | buffer: array[0..16383] of byte; 104 | strmInput: TFileStream; 105 | begin 106 | txtOutput.Clear; 107 | if not FileExists(boxInputFile.Text) then 108 | begin 109 | MessageDlg('File does not exist',mtInformation,[mbOK],0); 110 | Exit; 111 | end; 112 | Hashes := nil; 113 | // make a list of all the hash algorithms to use 114 | for i := 0 to lstHashes.Items.Count - 1 do 115 | begin 116 | if lstHashes.Checked[i] then 117 | begin 118 | // yes I know this is inefficient but it's also easy ;-) 119 | SetLength(Hashes,Length(Hashes) + 1); 120 | Hashes[Length(Hashes) - 1] := TDCP_hash(lstHashes.Items.Objects[i]); 121 | TDCP_hash(lstHashes.Items.Objects[i]).Init; 122 | end; 123 | end; 124 | strmInput := nil; 125 | try 126 | strmInput := TFileStream.Create(boxInputFile.Text,fmOpenRead); 127 | repeat 128 | // read into the buffer 129 | read := strmInput.Read(buffer,Sizeof(buffer)); 130 | // hash the buffer with each of the selected hashes 131 | for i := 0 to Length(Hashes) - 1 do 132 | Hashes[i].Update(buffer,read); 133 | until read <> Sizeof(buffer); 134 | strmInput.Free; 135 | // iterate through the selected hashes 136 | for i := 0 to Length(Hashes) - 1 do 137 | begin 138 | SetLength(HashDigest,Hashes[i].HashSize div 8); 139 | Hashes[i].Final(HashDigest[0]); // get the output 140 | s := ''; 141 | for j := 0 to Length(HashDigest) - 1 do // convert it into a hex string 142 | s := s + IntToHex(HashDigest[j],2); 143 | txtOutput.Lines.Add(Hashes[i].Algorithm + ': ' + s); 144 | end; 145 | except 146 | strmInput.Free; 147 | MessageDlg('An error occurred while reading the file',mtError,[mbOK],0); 148 | end; 149 | end; 150 | 151 | end. 152 | -------------------------------------------------------------------------------- /Docs/BlockCiphers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | DCPcrypt v2: Users Guide - Block Ciphers 4 | 5 | 6 |

DCPcrypt Cryptographic Component Library v2
7 | Copyright © 1999-2002 David Barton
8 | http://www.cityinthesky.co.uk/
9 | crypto@cityinthesky.co.uk
10 |

Block Ciphers - TDCP_blockcipher 11 |

All block ciphers are inherited from the TDCP_blockcipher component via either the TDCP_blockcipher64 and TDCP_blockcipher128 components (the latter implement the block size specific code). 12 |

The TDCP_blockcipher component extends the TDCP_cipher component to provide chaining mode functions. Functions available are: 13 |

14 |       property Initialized: boolean;
15 |       property Id: integer;
16 |       property Algorithm: string;
17 |       property MaxKeySize: integer;
18 |       property BlockSize: integer;
19 |       property CipherMode: TDCP_ciphermode;
20 |   
21 |       class function SelfTest: boolean;
22 |  
23 |       procedure SetIV(const Value);
24 |       procedure GetIV(var Value);
25 |  
26 |       procedure Init(const Key; Size: longword; InitVector: pointer); 
27 |       procedure InitStr(const Key: string; HashType: TDCP_hashclass);
28 |       procedure Burn; 
29 |       procedure Reset;
30 |       procedure Encrypt(const Indata; var Outdata; Size: longword); 
31 |       procedure Decrypt(const Indata; var Outdata; Size: longword); 
32 |       function EncryptStream(InStream, OutStream: TStream; Size: longword): longword;
33 |       function DecryptStream(InStream, OutStream: TStream; Size: longword): longword;
34 |       function EncryptString(const Str: string): string; 
35 |       function DecryptString(const Str: string): string; 
36 |       procedure EncryptECB(const Indata; var Outdata);
37 |       procedure DecryptECB(const Indata; var Outdata);
38 |       procedure EncryptCBC(const Indata; var Outdata; Size: longword);
39 |       procedure DecryptCBC(const Indata; var Outdata; Size: longword);
40 |       procedure EncryptCFB8bit(const Indata; var Outdata; Size: longword);
41 |       procedure DecryptCFB8bit(const Indata; var Outdata; Size: longword);
42 |       procedure EncryptCFBblock(const Indata; var Outdata; Size: longword);
43 |       procedure DecryptCFBblock(const Indata; var Outdata; Size: longword);
44 |       procedure EncryptOFB(const Indata; var Outdata; Size: longword);
45 |       procedure DecryptOFB(const Indata; var Outdata; Size: longword);
46 |       procedure EncryptCTR(const Indata; var Outdata; Size: longword);
47 |       procedure DecryptCTR(const Indata; var Outdata; Size: longword);
48 |     
49 |
50 |

Function descriptions 51 |

property BlockSize: integer; 52 |

This contains the block size of the cipher in BITS. 53 |

property CipherMode: TDCP_ciphermode; 54 |

This is the current chaining mode used when Encrypt is called. The available modes are: 55 |

62 |

Each chaining mode has it's own pro's and cons. See any good book on cryptography or the NIST publication SP800-38A for details on each. 63 |

procedure SetIV(const Value); 64 |

Use this procedure to set the current chaining mode information to Value. This variable should be the same size as the block size. When Reset is called subsequent to this, the chaining information will be set back to Value. 65 |

procedure GetIV(var Value); 66 |

This returns in Value the current chaining mode information, to get the initial chaining mode information you need to call Reset before calling GetIV. The variable passed in Value must be at least the same size as the block size otherwise you will get a buffer overflow. 67 |

procedure EncryptCBC(const Indata; var Outdata; Size: longword);
68 | procedure DecryptCBC(const Indata; var Outdata; Size: longword);
69 | procedure EncryptCFB8bit(const Indata; var Outdata; Size: longword);
70 | procedure DecryptCFB8bit(const Indata; var Outdata; Size: longword);
71 | procedure EncryptCFBblock(const Indata; var Outdata; Size: longword);
72 | procedure DecryptCFBblock(const Indata; var Outdata; Size: longword);
73 | procedure EncryptOFB(const Indata; var Outdata; Size: longword);
74 | procedure DecryptOFB(const Indata; var Outdata; Size: longword);
75 | procedure EncryptCTR(const Indata; var Outdata; Size: longword);
76 | procedure DecryptCTR(const Indata; var Outdata; Size: longword); 77 |

These procedures encrypt/decrypt Size bytes of data from Indata and places the result in Outdata. These all employ chaining mode methods of encryption/decryption and so may need to be used inconjunction with Reset. The CBC method uses short block encryption as specified in Bruce Schneier's "Applied Cryptography" for data blocks that are not multiples of the block size. 78 |

  79 |

Index, Ciphers, Hashes 80 |

  81 |

DCPcrypt is copyrighted © 1999-2002 David Barton.
82 | All trademarks are property of their respective owners.
83 | 84 | 85 | -------------------------------------------------------------------------------- /Docs/Hashes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | DCPcrypt v2: Users Guide - Hash Algorithms 4 | 5 | 6 |

DCPcrypt Cryptographic Component Library v2
7 | Copyright © 1999-2002 David Barton
8 | http://www.cityinthesky.co.uk/
9 | crypto@cityinthesky.co.uk
10 |

Hash Algorithms - TDCP_hash 11 |

All hashes are derived from the TDCP_hash component. It provides a range of functions to allow the hashing of virtually every type of data. 12 |

Functions available are: 13 |

 14 |       property Initialized: boolean;
 15 |       property Id: integer;
 16 |       property Algorithm: string;
 17 |       property HashSize: integer;
 18 |   
 19 |       class function SelfTest: boolean; 
 20 |   
 21 |       procedure Init; 
 22 |       procedure Final(var Digest); 
 23 |       procedure Burn; 
 24 |   
 25 |       procedure Update(const Buffer; Size: longword); 
 26 |       procedure UpdateStream(Stream: TStream; Size: longword);
 27 |       procedure UpdateStr(const Str: string);
 28 |     
29 |

Example usage: 30 |

33 |
34 |

property Initialized: boolean; 35 |

This is set to true after Init has been called. 36 |

property Id: integer; 37 |

Every algorithm I implement gets given a unique ID number so that if I use several different algorithms within a program I can determine which one was used. This is a purely arbitrary numbering system. 38 |

property Algorithm: string; 39 |

This is the name of the algorithm implemented in the component. 40 |

property HashSize: integer; 41 |

This is the size of the output of the hash algorithm in BITS. 42 |

class function SelfTest: boolean; 43 |

In order to test whether the implementations have all been compiled correctly you can call the SelfTest function. This compares the results of several hash operations with known results for the algorithms (so called test vectors). If all the tests are passed then true is returned. If ANY of the tests are failed then false is returned. You may want to run this function for all the components when you first install the DCPcrypt package and again if you modify any of the source files, you don't need to run this everytime your program is run. Note: this only performs a selection of tests, it is not exhaustive. 44 |

procedure Init; 45 |

Call this procedure to initialize the hash algorithm, this must be called before using the Update procedure. 46 |

procedure Final(var Digest); 47 |

This procedure returns the final message digest (hash) in Digest. This variable must be the same size as the hash size. This procedure also calls Burn to clear any stored information. 48 |

procedure Burn; 49 |

Call this procedure if you want to abort the hashing operation (normally Final is used). This clears all information stored within the hash. Before the hash can be used again Init must be called. 50 |

procedure Update(const Buffer; Size: longword); 51 |

This procedure hashes Size bytes of Buffer. To get the hash result call Final. 52 |

Update example: 53 |

 54 |   procedure HashBuffer(const Buffer; Size: longint; var Output);
 55 |   var
 56 |     Hash: TDCP_ripemd160;
 57 |   begin
 58 |     Hash:= TDCP_ripemd160.Create(nil);
 59 |     Hash.Init;
 60 |     Hash.Update(Buffer,Size);
 61 |     Hash.Final(Output);
 62 |     Hash.Free;
 63 |   end;
 64 |     
65 |

procedure UpdateStream(Stream: TStream; Size: longword); 66 |

This procedure hashes Size bytes from Stream. To get the hash result call Final. 67 |

procedure UpdateStr(const Str: string); 68 |

This procedure hashes the string Str. To get the hash result call Final. 69 |


70 |

Example 1 - File hashing 71 |

This example shows how you can hash the contents of a file 72 |

 73 |   procedure TForm1.Button1Click(Sender: TObject);
 74 |   var
 75 |     Hash: TDCP_ripemd160;
 76 |     Digest: array[0..19] of byte;  // RipeMD-160 produces a 160bit digest (20bytes)
 77 |     Source: TFileStream;
 78 |     i: integer;
 79 |     s: string;
 80 |   begin
 81 |     Source:= nil;
 82 |     try
 83 |       Source:= TFileStream.Create(Edit1.Text,fmOpenRead);  // open the file specified by Edit1
 84 |     except
 85 |       MessageDlg('Unable to open file',mtError,[mbOK],0);
 86 |     end;
 87 |     if Source <> nil then
 88 |     begin
 89 |       Hash:= TDCP_ripemd160.Create(Self);          // create the hash
 90 |       Hash.Init;                                   // initialize it
 91 |       Hash.UpdateStream(Source,Source.Size);       // hash the stream contents
 92 |       Hash.Final(Digest);                          // produce the digest
 93 |       Source.Free;
 94 |       s:= '';
 95 |       for i:= 0 to 19 do
 96 |         s:= s + IntToHex(Digest[i],2);
 97 |       Edit2.Text:= s;                              // display the digest
 98 |     end;
 99 |   end;
100 |     
101 |

  102 |

Index, Ciphers, Block Ciphers 103 |

  104 |

DCPcrypt is copyrighted © 1999-2002 David Barton.
105 | All trademarks are property of their respective owners.
106 | 107 | 108 | -------------------------------------------------------------------------------- /Docs/MIT_license.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the "Software"), 7 | to deal in the Software without restriction, including without limitation 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Docs/osi-certified-120x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CHERTS/DCPcrypt/6bafdd9981f0c716303d0c0558d250314aeffa58/Docs/osi-certified-120x100.png -------------------------------------------------------------------------------- /Hashes/DCPmd4.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | {* DCPcrypt v2.0 written by David Barton (crypto@cityinthesky.co.uk) **********} 3 | {******************************************************************************} 4 | {* A binary compatible implementation of MD4 **********************************} 5 | {******************************************************************************} 6 | {* Copyright (c) 1999-2002 David Barton *} 7 | {* Permission is hereby granted, free of charge, to any person obtaining a *} 8 | {* copy of this software and associated documentation files (the "Software"), *} 9 | {* to deal in the Software without restriction, including without limitation *} 10 | {* the rights to use, copy, modify, merge, publish, distribute, sublicense, *} 11 | {* and/or sell copies of the Software, and to permit persons to whom the *} 12 | {* Software is furnished to do so, subject to the following conditions: *} 13 | {* *} 14 | {* The above copyright notice and this permission notice shall be included in *} 15 | {* all copies or substantial portions of the Software. *} 16 | {* *} 17 | {* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *} 18 | {* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *} 19 | {* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *} 20 | {* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *} 21 | {* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *} 22 | {* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *} 23 | {* DEALINGS IN THE SOFTWARE. *} 24 | {******************************************************************************} 25 | unit DCPmd4; 26 | 27 | interface 28 | uses 29 | Classes, Sysutils, DCPcrypt2, DCPconst; 30 | 31 | type 32 | TDCP_md4= class(TDCP_hash) 33 | protected 34 | LenHi, LenLo: longword; 35 | Index: DWord; 36 | CurrentHash: array[0..3] of DWord; 37 | HashBuffer: array[0..63] of byte; 38 | procedure Compress; 39 | public 40 | class function GetId: integer; override; 41 | class function GetAlgorithm: string; override; 42 | class function GetHashSize: integer; override; 43 | class function SelfTest: boolean; override; 44 | procedure Init; override; 45 | procedure Burn; override; 46 | procedure Update(const Buffer; Size: longword); override; 47 | procedure Final(var Digest); override; 48 | end; 49 | 50 | 51 | 52 | {******************************************************************************} 53 | {******************************************************************************} 54 | implementation 55 | {$R-}{$Q-} 56 | 57 | function LRot32(a, b: longword): longword; 58 | begin 59 | Result:= (a shl b) or (a shr (32-b)); 60 | end; 61 | 62 | procedure TDCP_md4.Compress; 63 | var 64 | Data: array[0..15] of dword; 65 | A, B, C, D: dword; 66 | begin 67 | Move(HashBuffer,Data,Sizeof(Data)); 68 | A:= CurrentHash[0]; 69 | B:= CurrentHash[1]; 70 | C:= CurrentHash[2]; 71 | D:= CurrentHash[3]; 72 | 73 | A:= LRot32(A + (D xor (B and (C xor D))) + Data[ 0],3); 74 | D:= LRot32(D + (C xor (A and (B xor C))) + Data[ 1],7); 75 | C:= LRot32(C + (B xor (D and (A xor B))) + Data[ 2],11); 76 | B:= LRot32(B + (A xor (C and (D xor A))) + Data[ 3],19); 77 | A:= LRot32(A + (D xor (B and (C xor D))) + Data[ 4],3); 78 | D:= LRot32(D + (C xor (A and (B xor C))) + Data[ 5],7); 79 | C:= LRot32(C + (B xor (D and (A xor B))) + Data[ 6],11); 80 | B:= LRot32(B + (A xor (C and (D xor A))) + Data[ 7],19); 81 | A:= LRot32(A + (D xor (B and (C xor D))) + Data[ 8],3); 82 | D:= LRot32(D + (C xor (A and (B xor C))) + Data[ 9],7); 83 | C:= LRot32(C + (B xor (D and (A xor B))) + Data[10],11); 84 | B:= LRot32(B + (A xor (C and (D xor A))) + Data[11],19); 85 | A:= LRot32(A + (D xor (B and (C xor D))) + Data[12],3); 86 | D:= LRot32(D + (C xor (A and (B xor C))) + Data[13],7); 87 | C:= LRot32(C + (B xor (D and (A xor B))) + Data[14],11); 88 | B:= LRot32(B + (A xor (C and (D xor A))) + Data[15],19); 89 | 90 | A:= LRot32(A + ((B and C) or (B and D) or (C and D)) + Data[ 0] + $5a827999,3); 91 | D:= LRot32(D + ((A and B) or (A and C) or (B and C)) + Data[ 4] + $5a827999,5); 92 | C:= LRot32(C + ((D and A) or (D and B) or (A and B)) + Data[ 8] + $5a827999,9); 93 | B:= LRot32(B + ((C and D) or (C and A) or (D and A)) + Data[12] + $5a827999,13); 94 | A:= LRot32(A + ((B and C) or (B and D) or (C and D)) + Data[ 1] + $5a827999,3); 95 | D:= LRot32(D + ((A and B) or (A and C) or (B and C)) + Data[ 5] + $5a827999,5); 96 | C:= LRot32(C + ((D and A) or (D and B) or (A and B)) + Data[ 9] + $5a827999,9); 97 | B:= LRot32(B + ((C and D) or (C and A) or (D and A)) + Data[13] + $5a827999,13); 98 | A:= LRot32(A + ((B and C) or (B and D) or (C and D)) + Data[ 2] + $5a827999,3); 99 | D:= LRot32(D + ((A and B) or (A and C) or (B and C)) + Data[ 6] + $5a827999,5); 100 | C:= LRot32(C + ((D and A) or (D and B) or (A and B)) + Data[10] + $5a827999,9); 101 | B:= LRot32(B + ((C and D) or (C and A) or (D and A)) + Data[14] + $5a827999,13); 102 | A:= LRot32(A + ((B and C) or (B and D) or (C and D)) + Data[ 3] + $5a827999,3); 103 | D:= LRot32(D + ((A and B) or (A and C) or (B and C)) + Data[ 7] + $5a827999,5); 104 | C:= LRot32(C + ((D and A) or (D and B) or (A and B)) + Data[11] + $5a827999,9); 105 | B:= LRot32(B + ((C and D) or (C and A) or (D and A)) + Data[15] + $5a827999,13); 106 | 107 | A:= LRot32(A + (B xor C xor D) + Data[ 0] + $6ed9eba1,3); 108 | D:= LRot32(D + (A xor B xor C) + Data[ 8] + $6ed9eba1,9); 109 | C:= LRot32(C + (D xor A xor B) + Data[ 4] + $6ed9eba1,11); 110 | B:= LRot32(B + (C xor D xor A) + Data[12] + $6ed9eba1,15); 111 | A:= LRot32(A + (B xor C xor D) + Data[ 2] + $6ed9eba1,3); 112 | D:= LRot32(D + (A xor B xor C) + Data[10] + $6ed9eba1,9); 113 | C:= LRot32(C + (D xor A xor B) + Data[ 6] + $6ed9eba1,11); 114 | B:= LRot32(B + (C xor D xor A) + Data[14] + $6ed9eba1,15); 115 | A:= LRot32(A + (B xor C xor D) + Data[ 1] + $6ed9eba1,3); 116 | D:= LRot32(D + (A xor B xor C) + Data[ 9] + $6ed9eba1,9); 117 | C:= LRot32(C + (D xor A xor B) + Data[ 5] + $6ed9eba1,11); 118 | B:= LRot32(B + (C xor D xor A) + Data[13] + $6ed9eba1,15); 119 | A:= LRot32(A + (B xor C xor D) + Data[ 3] + $6ed9eba1,3); 120 | D:= LRot32(D + (A xor B xor C) + Data[11] + $6ed9eba1,9); 121 | C:= LRot32(C + (D xor A xor B) + Data[ 7] + $6ed9eba1,11); 122 | B:= LRot32(B + (C xor D xor A) + Data[15] + $6ed9eba1,15); 123 | 124 | Inc(CurrentHash[0],A); 125 | Inc(CurrentHash[1],B); 126 | Inc(CurrentHash[2],C); 127 | Inc(CurrentHash[3],D); 128 | Index:= 0; 129 | FillChar(HashBuffer,Sizeof(HashBuffer),0); 130 | end; 131 | 132 | class function TDCP_md4.GetHashSize: integer; 133 | begin 134 | Result:= 128; 135 | end; 136 | 137 | class function TDCP_md4.GetId: integer; 138 | begin 139 | Result:= DCP_md4; 140 | end; 141 | 142 | class function TDCP_md4.GetAlgorithm: string; 143 | begin 144 | Result:= 'MD4'; 145 | end; 146 | 147 | class function TDCP_md4.SelfTest: boolean; 148 | const 149 | Test1Out: array[0..15] of byte= 150 | ($a4,$48,$01,$7a,$af,$21,$d8,$52,$5f,$c1,$0a,$e8,$7a,$a6,$72,$9d); 151 | Test2Out: array[0..15] of byte= 152 | ($d7,$9e,$1c,$30,$8a,$a5,$bb,$cd,$ee,$a8,$ed,$63,$df,$41,$2d,$a9); 153 | var 154 | TestHash: TDCP_md4; 155 | TestOut: array[0..19] of byte; 156 | begin 157 | TestHash:= TDCP_md4.Create(nil); 158 | TestHash.Init; 159 | TestHash.UpdateStr('abc'); 160 | TestHash.Final(TestOut); 161 | Result:= CompareMem(@TestOut,@Test1Out,Sizeof(Test1Out)); 162 | TestHash.Init; 163 | TestHash.UpdateStr('abcdefghijklmnopqrstuvwxyz'); 164 | TestHash.Final(TestOut); 165 | Result:= CompareMem(@TestOut,@Test2Out,Sizeof(Test2Out)) and Result; 166 | TestHash.Free; 167 | end; 168 | 169 | procedure TDCP_md4.Init; 170 | begin 171 | Burn; 172 | CurrentHash[0]:= $67452301; 173 | CurrentHash[1]:= $efcdab89; 174 | CurrentHash[2]:= $98badcfe; 175 | CurrentHash[3]:= $10325476; 176 | fInitialized:= true; 177 | end; 178 | 179 | procedure TDCP_md4.Burn; 180 | begin 181 | LenHi:= 0; LenLo:= 0; 182 | Index:= 0; 183 | FillChar(HashBuffer,Sizeof(HashBuffer),0); 184 | FillChar(CurrentHash,Sizeof(CurrentHash),0); 185 | fInitialized:= false; 186 | end; 187 | 188 | procedure TDCP_md4.Update(const Buffer; Size: longword); 189 | var 190 | PBuf: ^byte; 191 | begin 192 | if not fInitialized then 193 | raise EDCP_hash.Create('Hash not initialized'); 194 | 195 | Inc(LenHi,Size shr 29); 196 | Inc(LenLo,Size*8); 197 | if LenLo< (Size*8) then 198 | Inc(LenHi); 199 | 200 | PBuf:= @Buffer; 201 | while Size> 0 do 202 | begin 203 | if (Sizeof(HashBuffer)-Index)<= DWord(Size) then 204 | begin 205 | Move(PBuf^,HashBuffer[Index],Sizeof(HashBuffer)-Index); 206 | Dec(Size,Sizeof(HashBuffer)-Index); 207 | Inc(PBuf,Sizeof(HashBuffer)-Index); 208 | Compress; 209 | end 210 | else 211 | begin 212 | Move(PBuf^,HashBuffer[Index],Size); 213 | Inc(Index,Size); 214 | Size:= 0; 215 | end; 216 | end; 217 | end; 218 | 219 | procedure TDCP_md4.Final(var Digest); 220 | begin 221 | if not fInitialized then 222 | raise EDCP_hash.Create('Hash not initialized'); 223 | HashBuffer[Index]:= $80; 224 | if Index>= 56 then 225 | Compress; 226 | PDWord(@HashBuffer[56])^:= LenLo; 227 | PDWord(@HashBuffer[60])^:= LenHi; 228 | Compress; 229 | Move(CurrentHash,Digest,Sizeof(CurrentHash)); 230 | Burn; 231 | end; 232 | 233 | end. 234 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DCPcrypt 2 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3 | = DCPcrypt Cryptographic Component Library v2 = 4 | = Copyright (c) 1999-2009 David Barton = 5 | = http://www.cityinthesky.co.uk/ = 6 | = crypto@cityinthesky.co.uk = 7 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 8 | 9 | -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 2 | = DCPcrypt Cryptographic Component Library v2 = 3 | = Copyright (c) 1999-2009 David Barton = 4 | = http://www.cityinthesky.co.uk/ = 5 | = crypto@cityinthesky.co.uk = 6 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 7 | 8 | UPDATE: 9 | 10 | Included is an update for Delphi 2009 by Henri Gourvest. Note: I have 11 | not tested this myself (I don't have Delphi 2009) 12 | 13 | 14 | Introduction: 15 | 16 | DCPcrypt is a collection of cryptographic components for the Borland 17 | Delphi(tm), C++ Builder(tm) and Kylix(tm) programming languages. The 18 | supported versions are Delphi 4, 5, 6, 7, 2005, C++ Builder (3?), 4, 19 | 5, (6?) and Kylix 1 (untested), 2 and 3 (untested). 20 | 21 | Thanks to Manuel C. for the modifications to make DCPcrypt work under 22 | Delphi 2005! 23 | 24 | The idea behind DCPcrypt is that it should be possible to "drop in" 25 | any algorithm implementation to replace another with minimum or no 26 | code changes. To aid in this goal all cryptographic components are 27 | descended from one of several base classes, TDCP_cipher for encryption 28 | algorithms and TDCP_hash for message digest algorithms. 29 | 30 | DCPcrypt is open source software (released under the MIT license) and 31 | as such there is no charge for inclusion in other software. However, I 32 | am currently a student and if you are making money from my software I 33 | would really appreciate a donation of some sort, whether financial or 34 | a license for the software you develop (or if anyone wants to sponsor 35 | a Mathematical Modelling (Masters) student for their final year...). 36 | Please note THIS IS NOT COMPULSORY IN ANY WAY. See 37 | http://www.cityinthesky.co.uk/cryptography.html for details on 38 | financial donations. 39 | 40 | This software is OSI Certified Open Source Software. 41 | OSI Certified is a certification mark of the Open Source Initiative. 42 | 43 | If you maintain a website then a link to my page at 44 | http://www.cityinthesky.co.uk/ would be great! 45 | 46 | 47 | 48 | What's New: 49 | 50 | Changes since DCPcrypt v2 Beta 2 include 51 | 52 | * Corrected C++ Builder compilation problem. 53 | 54 | 55 | Changes since DCPcrypt v2 Beta 1 include 56 | 57 | * Renamed source code files for hashes and ciphers to DCPxxx.pas 58 | 59 | * Change the format of Cipher.InitStr so that the hash algorithm 60 | used to generate the key is explicitly specified. In order to 61 | get the same functionality as before, use TDCP_sha1. 62 | e.g. Cipher.InitStr('Hello World',TDCP_sha1); 63 | 64 | * Block ciphers are now inherited from an intermediate component 65 | that implements the block size specific chaining mode encryption 66 | routines. 67 | 68 | * Remove the internal component registration, it was more hassle 69 | than it was worth. If there is a demand for this to be put back 70 | then I might... 71 | 72 | * Added the full range of operation modes for Haval. By changing 73 | the defines at the top of DCPhaval.pas you can specify the 74 | number of passes and the output hash size. 75 | 76 | * Added the Tiger hash algorithm (192bit digest). 77 | 78 | * Changed the name of the file containing TDCP_ripemd160 for 79 | consistency to DCPripemd160 from DCPrmd160. 80 | 81 | * GOST no longer appears on the component palette pending verifying 82 | what the actual standard is (the code is still included however). 83 | 84 | * Added the RipeMD-128 hash algorithm (128bit digest). 85 | 86 | * Added the Serpent block cipher (AES finalist). 87 | 88 | * Added the SHA-256,384,512 hash algorithms (256, 384, 512bit digest 89 | respectively). 90 | 91 | * Added CTR chaining mode to all block ciphers. 92 | 93 | 94 | 95 | Installation: 96 | 97 | Delphi: Open the appropriate package, DCPdelphiX.dpk where X is 98 | your version of Delphi (either 4, 5 or 6). Then press the 99 | install button. 100 | 101 | C++ Builder: Create a new design time package and add all the .pas 102 | files from the DCPcrypt2.zip archive including all those 103 | in the Ciphers and Hashes subdirectories. Then press the 104 | install button. 105 | 106 | Kylix: Open the DCPkylix.dpk package and then press the install 107 | button (note: Kylix 1 users may need to create a new 108 | package as with C++ Builder as this is a Kylix 2 package). 109 | 110 | You may need to add the directory containing DCPcrypt (and the Ciphers 111 | and Hashes subdirectories) to your library search path (found under 112 | Environment Options). 113 | 114 | Once installed you will find two extra pages of components on your 115 | component palette, namely DCPciphers and DCPhashes. You can now place 116 | these components onto the form of your application to start using the 117 | algorithms. 118 | 119 | 120 | 121 | Usage: 122 | 123 | See the main html documentation in the Docs subdirectory. 124 | 125 | 126 | 127 | Contact: 128 | 129 | I appreciate knowing what DCPcrypt is being used for and also if you 130 | have any queries or bug reports please email me at crypto@cityinthesky.co.uk. 131 | 132 | 133 | 134 | DCPcrypt is copyrighted (c) 1999-2003 David Barton. 135 | All trademarks are property of their respective owners. 136 | --------------------------------------------------------------------------------