Shrink Your File Format

August 8, 2007 at 2:40 am 1 comment

Want to shrink the file format in your program?  Here’s a method for shrinking your numbers down.  If you write the number “127” to a file, you are writing three bytes to the file (the ASCII character for each number).  This might not seem like a big deal, but in the long haul you can save a ton of space using the following method.  Write the character for 127 (\x7f, but printed as ).  Now read the file’s charachter and convert it into a number.  You just saved two bytes.  For writing numbers bigger than 256 (ASCII limit), write partials of numbers.  Break these numbers up in parts of two (589406830=58|94|06|83|0).  It might not be the most efficient way to shrink these numbers down, but it is easy to code and could save space in the long run.  If you want to shrink your numbers even more, convert them to hexadecimal before writing them to a file (hex was originally designed to write huge numbers).  Read these suckers back, feed it all into one string, and convert the string to an integer.  Congratulations on shrinking your file format.


Entry filed under: Computers, Hacking, Math, Programming, Scripting, Software, Technology, Tips.

Passwords and How They are Stolen Ha, Not Dead!

1 Comment Add your own

  • 1. Johnc179  |  May 31, 2014 at 8:43 pm

    Hello, i think that i saw you visited my site so i came to return the favor.I am trying to find things to enhance my web site!I suppose its ok to use some of your ideas!! gdfcfcdcfgbe


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

August 2007
« Jul   Sep »


%d bloggers like this: