oddmedley has asked for the wisdom of the Perl Monks concerning the following question:
in the RC4 sub, produces an array of 37 characters! even when I alter the substr call and set the last argument to 32, still, the size of @message is 37... when I feed the output of the RC4 back into itself (as in the algorithm for producing the O val for a PDF file encryption dictionary, revision 3), the size of @message blows up to several kb, when it should stay at 32 bytes... I've checked the arguments to the RC4 sub in cases a) and b) and they are the same, and yet the output is different. does anyone know of any reason this could happen? if it helps the inputs to the RC4 function are (converted to hex so you can read them, the actual function gets the ascii strings):my @message = unpack "C*", substr($message, $piece * $MAX_CHUNK_SI +ZE, $MAX_CHUNK_SIZE);
the first iteration output (in hex) in case a) is: DFB79756C2D1B49F540DC80A3C39290C6F6B61539635BE03CC2E82990C6A974503ABBC84A2 and in case b): DFB79756C2D1B49F540DC80A3C44D81C7F509ED0787494557D82402EE1FE96FBRC4(36A756FC8BA497CA34532CA4A1086AD0, 637573746F6D65726E616D6528BF4E5E +4E758A4164004E56FFFA01082E2E00B6)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perplexing inconsistency using RC4 and unpack
by Anonymous Monk on Aug 01, 2009 at 03:00 UTC | |
by oddmedley (Novice) on Aug 01, 2009 at 03:27 UTC | |
by tye (Sage) on Aug 01, 2009 at 05:44 UTC | |
by oddmedley (Novice) on Aug 01, 2009 at 14:44 UTC | |
by Anonymous Monk on Aug 01, 2009 at 03:37 UTC |