bytes compressed and encrypted


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default An ugly way

    Hi,

    If the size of the stored data is important this might be one way.

    I ASSUME that you will only store numbers, and these numbers are from 0-9.

    Imagine a number serie like this one where each number is one byte (8 bits):

    1 1 1 2 3 4 ..... 9 9

    Step one:

    Group bytes 2 and 2 so you get this number serie stored as bytes, this I think you have already figured out:

    when you do this you have to make sure you calculate in DECIMAL
    3 4 -> 3 * 10 + 4 = 34 dec

    11 12 34 ..... 99

    Step 2:

    Since the biggest number you will have to store this way is 99 it is enough to use 7 bits. So now we store 7 lower bits from the first byte + one bit from the next byte =8 and write to the eeprom.

    This way will allow you to store 18 numbers using 8 Bytes. 44,4% size of the original data


    This will also encrypt your data a little bit, if you want it to be more encrypted you just re-arrange the bit order in the BYTE you write to the ee-prom. If you have a good plan how to re-arrange the bits that covers 8 bytes it will be close to impossible to find out what you have stored. Bits inside this 8-byte block change places with each other.. or any other way of maipulating the bits with factor X .

    To get the data back you just need to undo what you have done and put the bits back... extract the 7 + 1 bit into bytes... and split the Byte into 2.

    So that would mean that you will work in block of 8 bytes compressing, encrypting and so on.

    /me
    Last edited by Jumper; - 2nd March 2009 at 13:34.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts