Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Playful puzzle

Reply
Thread Tools

Playful puzzle

 
 
Roedy Green
Guest
Posts: n/a
 
      10-09-2011
I offer this is the spirit of play. It is not a serious problem.

Lets say you had a PAD file that among other things included the
zipped size of the distributable inside it in ASCII bytes. But the
PAD file itself is inside the distributable.

In the worst case, how many times must you adjust the size in the PAD
and rezip with java.util.zip if you want to be 100% sure it is bang on
accurate?
--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.

 
Reply With Quote
 
 
 
 
Andreas Leitgeb
Guest
Posts: n/a
 
      10-10-2011
Roedy Green <> wrote:
> I offer this is the spirit of play. It is not a serious problem.



> Lets say you had a PAD file that among other things included the
> zipped size of the distributable inside it in ASCII bytes. But the
> PAD file itself is inside the distributable.
> In the worst case, how many times must you adjust the size in the PAD
> and rezip with java.util.zip if you want to be 100% sure it is bang on
> accurate?


In the worst case, you might never ever get a bang:

e.g. you start with number 00000, and may get a zipped file of 55554 bytes,
then you write 55554 (with a tiny bit more entropy) and now get 55555 bytes.
Then you write 55555 (which that tiny bit less entropy) and get 55554 bytes...

PS: I have no idea, if such cycles will really show up, but it appears
plausible to me that they could...

PPS: there may, however be a way out: By giving a slightly larger size
and a means to add further entropy into the pad-file or into an extra
file of the distributable, you can add just as much rubbish, until the
initial size-overestimate is reached - and if it is surpassed rather than
reached, then re-iterate with incremented size-estimate.

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      10-10-2011
On 10/9/11 3:45 AM, Roedy Green wrote:
> I offer this is the spirit of play. It is not a serious problem.
>
> Lets say you had a PAD file that among other things included the
> zipped size of the distributable inside it in ASCII bytes. But the
> PAD file itself is inside the distributable.

What is an ASCII byte? Do you mean the number of ASCII characters?
>
> In the worst case, how many times must you adjust the size in the PAD
> and rezip with java.util.zip if you want to be 100% sure it is bang on
> accurate?


It may be the case that there is no answer, unless you add padding. It
is possible that if you underestimate by one, then adding one will
actually change the file size to be smaller!

Alternatively, there is a way to store data into a ZIP file that doesn't
actually compress the data, so you can in that way deterministically
figure out the final size
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
playful coding problems for 10 year olds Daniel Fetchinson Python 9 11-26-2010 04:58 PM
Home networking puzzle?!? =?Utf-8?B?Qm9ya28=?= Wireless Networking 3 01-25-2005 06:49 AM
A NS puzzle:) Brad Snow Firefox 6 09-03-2004 04:54 AM
A puzzle to puzzle you sk A+ Certification 1 07-17-2004 05:19 PM
DVD Verdict reviews: DIE! DIE! MY DARLING!, LOOK! PLAYFUL PATTERNS AND SIMPLE SHAPES / GO! EXERCISE WITH THE TELETUBBIES, and more! DVD Verdict DVD Video 0 09-26-2003 09:02 AM



Advertisments