digitalmars.D - Support for zip decryption -- File attached
- Jarrett Billingsley (140/140) Dec 31 2004 I wrote a ziplib for use with another language (Blitz3D). I made sure t...
-
Simon Buchan
(3/6)
Jan 03 2005
- Jarrett Billingsley (10/11) Jan 03 2005 Not to sound condescending, but opensource isn't really big in the Blitz...
- Simon Buchan (12/23) Jan 03 2005 :D
I wrote a ziplib for use with another language (Blitz3D). I made sure to add decryption support so that I could encrypt my game data files with winrar and still be able to extract them in the game. I noticed that std.zip didn't have any decryption support, so I added it. It doesn't have any support for encryption (adding files to the archive and encrypting them), but that might come later. The attached file contains myzip.d, which is exactly the same as std.zip, except that the ZipArchive.expand() function no longer throws an exception if it finds an encrypted file, and it has an extra optional parameter - a char[] for the password. So to decrypt a file, you'd do something like.. ubyte[] data=zip.expand(zip.directory["test.txt"],"qwe"); Where "qwe" is the password. Note that because of the way zip encryption works, there is not necessarily a "right" or "wrong" password - use the wrong password, and it'll decrypt the file into nonsensical garbage. There is another file in the attached zip called message.txt. Try extracting it using the new expand() function with the password "walter". begin 666 myzip.zip M+ /^#QT MBD7V"Z=[)-NY#X MFE]D:[/F[GZ]:;-M:\[?+1MU,3MCX/?YF6;5;IK5MM$H].5+8]7NYA((5VT8 M>9[]^7:S?IVUM\TV6Z\RN]FL-]OSIT^RYR\] 5[*[3;[S^;^VS?:WK<-D'R9 MTR?OA]6^WNC;YA?[1WNG[*9?8K>]]5;=26/_W6ZV7I/+C)*+9-:^:3=2MX<) MW%+>;-,AO;Z[W]BM9_BC;6_7)DYWR)Y_L]Y^URSMGYL[F[7P7\<.(&9ZHPN: M?.<)2+=V;FO;?B[NTDH.AJBWK84A!.\BH0)K[BSZRIAPL/$;V<J)E&!FG J3 MZ'<+]+N1;_B?OZP;D^'$XB0.H=L<X9A;''M%82.??7[^?/OLQ]7Q&:KN/6=$ M)8A^9^8DQ)PS33V0I6+V&?).]&OC_?GHY<ML8[U)X%;-Z 82G\W\QXWUO& O MJ+QJM^,P79F-U7]* Q!GIF'?C?[0RD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 9SQW$CY "=YW[ND=](.%3&)6+,;GBIDQ'>_I'BYHQCRBYWFL MIAES=>703%V3D+&)1I.*):$?M#E0WXRI:3S'YVJ<A"[B,EOG)(1B:(Z2[[^, M6H?AO?-#W M&3*$.[C]BQ?9MRL,=^C. H5=6SDB^=J W?[BY9_/L]\URV6SNMDN[=L0YZ.; M(]]^OXE^FTKLW 'QL.%W^>#OMMTYYV_LP#TQ ?C$F7EX=O<=?#XI^^'N!.Q. MHJX<.>N2<']B>,Q_\ ?&3U_E%/[O3XDNU6-ZGCYF^^EZHB,:E+V&;<6['1GS M7#P M,4B_^ND%G+*/V7N:4R [&2T'=J_ BU[#T2=7WLS( 9./OOT20P>[I_';+^/T MUCE7`,'L[N-U5G=,SKT1DTKM7H+!^,M+[T<23IZ;1H<CRE__&N]4 _IX)CG( M[_Y[HQWO/[79K=R&[T<Y!['A[T7\U='&_FW7;+KO3M$,2X%;"]WZ9N#VR8"% M*8A;$+TY/VCL_&LY4"?/OIB#R$RRZIFW]>1CP$K?L3G8EGW0"S9'_?WBD5UN MRB,921_=GD2.?C[?FX=E,KP.>-BN?A_.PM[LYC?D=\W-G$$[?R $4(%Q,&$6 M86^F/TNB(JA+VK;\.GYI>\C%716&0V/UNIXAE'F?WY]U7PKO\L?S$YPZ"ZS) MX_'^&4QX5S'SCS?'5,/UQ*25^IS0-]EQ%-J[3G<5NP WY?Z&!M*2?\ 9GL$. M<V%G92YT>'3073DF7*9]FP/YO:''XOB ;G0`CZ!)2 WU% XG8B<CX1IMZE!+ M!PCCS RB(P```!<```!02P$"% `4````" `N9I\Q[SJ/J!X4``"T0P``!P`` M```````!`" ` ($`````;7EZ:7 N9%!+`0(4``H`"0```$QGGS'CS RB(P`` M`!<````+``````````$`( " 4,4``!M97-S86=E+G1X=%!+!08`````` `" +`&X```"?% `````` ` end
Dec 31 2004
On Fri, 31 Dec 2004 13:01:29 -0500, Jarrett Billingsley <kb3ctd2 yahoo.com> wrote:I wrote a ziplib for use with another language (Blitz3D). I made sure to add decryption support so that I could encrypt my game data files with winrar and still be able to extract them in the game. I noticed that<snip> Heh... I hope your game isn't OSS :D
Jan 03 2005
Heh... I hope your game isn't OSS :DNot to sound condescending, but opensource isn't really big in the Blitz3D community. In fact it's quite the opposite - just about everything has a price. Usually a small price, but a price nonetheless. Can't say as I'm too happy about it, but that's just because most of the people who use B3D were raised on shareware. I suppose I could break the mold and release my game as opensource, but then that'd defeat the purpose of my beautiful zip decryption ;) I didn't expect this addition to phobos to be that big, so I'm not that surprised that no one else has replied. Just curious, do you have any use for this?
Jan 03 2005
On Mon, 3 Jan 2005 17:26:27 -0500, Jarrett Billingsley <kb3ctd2 yahoo.com> wrote:Hmmm.....Heh... I hope your game isn't OSS :DNot to sound condescending, but opensource isn't really big in the Blitz3D community. In fact it's quite the opposite - just about everything has a price. Usually a small price, but a price nonetheless. Can't say as I'm too happy about it, but that's just because most of the people who use B3D were raised on shareware.I suppose I could break the mold and release my game as opensource, but then that'd defeat the purpose of my beautiful zip decryption ;):DI didn't expect this addition to phobos to be that big, so I'm not that surprised that no one else has replied. Just curious, do you have any use for this?Probably not, but for a completionist point of veiw (or for a proof-of-concept extraction program or something) it's not as if it's pointless. In a predominantly OSS comunity like this (as most programming communities are) it is kind of pointless though, which may be part of the reason why it wasn't included in the first place. -- "Yes, the american troops have advanced further. This will only make it easier for us to defeat them" - Iraqi Information Minister Muhammed Saeed al-Sahaf
Jan 03 2005