I have always was interested in how to compress file/information to a smaller size like using characters instead of using words (a character would stand for a word) and how to secure information like XOR encryption.
but compression was the thing I was thinking about for a long time, still doing that stuff
it all started with My calculator, yes my calculator, as I developed a program for the calculator which you could use to draw awesome painting
(CalcPaint)
the problem is: you have a list of a max length of 999 numbers, and you need to save the X and Y components, (I could use a matrix but that needs must more space), so How I solve it? simple the screen has a size of 68 x 128 pixel
so I did the following:
X + (100/Y) --> List1[0]
so coordinates were simply stored as 1 number
a normal picture would look something like this:
25,30
26,30
45,5
etc
this saved me 2 the spaced actually needed, and pictures can now be 999 pixels max, instead of the half
Lucky the calculator has 2 options:
Int and Frac
- Int would return everything that is on the left side of the comma.
- Frac does the opposition it would return everything on the right side but it would make it a whole number it would just return it as 0.30 instead of 25.30, still multiply by 100 and you got your Y component back
so translation back looked like this:
list1[0] -> A
Int A -> X
100Frac A -> Y
PixelOn Y,X
I yet have to find these functions on the Computer with program, but I guess string.split(Decimal.ToString(),',') will work just fine
after some strange Compression methods that requirs to enhance the whole program to a size of 266% and then compress it to a size of 89% of the orginal file size, but a smaller compression ration, or process speed isn't achieved
the whole method was basically this:
first take a byte turn into 8 characters take all the characters and put them after each other then make a patron into a character: and repeat until it is impossible.
255 -> 11111111
3 -> 00000011
86 -> 1010110
0000 -> A
1111 -> B
101 -> C
110 -> D
000 -> E
111 -> F
11 -> G
00 -> H
1 -> I
0 -> J
II -> K
JJ -> L
etc
so applied:
11111111000000111010110 -> BBAHGCJD
so if you would extend this kind of pattern more it would compress a lot, Decompression is just done completely Backwards
this was always an Annoying thing to do, and it wasn't really an algorithm :S
after some attempts more to do it like above I give up looked for something else,
I started to do a lot more with binary number on my calculator and made a program in which you could calculate whole list of binary commands and numbers that were depended on each other, I probably did that to understand more of CPU stuff,
turned out nice I guess, I then started more XOR and its possible content,
then
ande's simple Xor Encryption came to mind, why is it possible to Encrypt and Decrypt stuff with a single key?, how can you make it more complicated?
the interseting part is once Encrypted you'll need the key to Decrypt because with that keys you had the information on what the Decrypted number is, with that key you could compare the binary numbers with each other and tell what number was hidden under it:
example
So: 10101101
Key: 01101010
-------- Xor (True when not equel)
En: 11000111
(So = source)
now you just have that one simple number with that number you can do things
- if you have the source you can find the key
- if you have the key you can find the source
- you cannot though both with doing something useless
getting the key:
So: 10101101
En: 11000111
-------- Xor
Key: 01101010
getting source:
En: 11000111
Key: 01101010
-------- Xor
So: 10101101
tada its magic
now I wonderd? is it possible to take 3 bytes and store 1 of them in the other 2 using Xor?
while lets try:
00000001 00000010 00000011 (1,2,3)
so we hide 3 in 1 and 2:
00000001
00000011
-------- Xor
00000010
00000010
00000011
------- Xor
00000001
so we got 10 and 01 (2 , 1)
now to convert back
00000010
00000001
-------- Xor
00000011
now we have 3 again and with this we can convert 2 , 1 back to 1, 2
add 3 after it and we have our normal byte array back 1, 2 ,3
me full excited when I first discovered this tried to do it on more different numbers:
4, 5, 6
00000100 00000101 00000110
00000100
00000110
-------- Xor
00000010
00000101
00000110
-------- Xor
00000011
so we got 1 and 3
now convert back
00000010
00000011
-------- Xor
00000001
is 1 but we used 6
as you can see its has a big problem, not everything goes as wanted T.T
as glad as I was when I first found this I also was fast disappointed in the fact that this happen T.T
I didn't sit still And the months after I tried Different methods i used And, Or, Not, Xor, Nand, Xand, Nor, but nothing all had big flaws, even combinations of those before or after it didn't matter it was all to random, I even tried it with a 4 number combination, results were the same.
I'm disappointed I couldn't find anything but I wont wait for a miracle, i'll continue to search for a method that will work.
but just let me get to the possibilities of this kind of compression,
lets do a little math: you start with 3, end with 2 you have lost 1/3
and now i you compress what you have compressed you have 1/3 of 1/3 (1/3), this means you can go on and on and on with your compress of your files,
you can compress this shit until you have hit a minimum size of 2 bytes (File Info like Name, not counted)
so in theory if your 2.0 TB External HDD is full you can Compress it, to a mere 2 bytes
and when its full of compressed files you can compress that again to a mere 2 bytes
in theory you can put any information no matter how big it is on a facking Floppy
you can put every movie every made on a floppy
heck, you can put every single bit of information on a floppy, and still have rooms to spare to do it a few times more
though the time needed to do this is probably pretty long
but hey you could do it
though I didn't succeed in doing this, I feel very disappointed that I didn't find a method, I hope I will find it one day