Here is my New Base128 encoding (I have also posted it on Devshed) Format how the words will be replaced: See the image at the bottom of the page about the format Now I small example to illustrate how it works This how it works Base128: For the words :"SHANMUG" it is encoded as "[|½8-W£‹" (8 bytes) Here the a 7 bytes string is encoded as 8 bytes string(base128) Here "S" is converted into "57"(7 bytes) and then the corresponding value for 57 is taken from the table is used to encode "S" …in this case it is "[" Base64: word="SHANMUG" base64 encoding-"U0hBTk1VRw==" (12 bytes) whereas in base64 encoding a 7 bytes string is encoded as 12 bytes string (So there is a loss of5 bytes ) but in base128 encoding only 1 byte is lost in encoding a 7 byte string into 8 byte string (Only a loss of 1 byte) Advantages of base128 encoding a)occupies less space when compared with base64 encoding (base128) b)when data is being transmitted by base128 encoding it makes the data transfer easier as only less amount of data needs to be transmitted when compared with base64 I have also attached a php file(base128.txt) with it Download it and save it as .php and when you want to encode something use this sample program make sure that 'base128.php' exists in the same folder. To use base128.php you should use this.. Base128 encoding: Base128 encoding in Php
edit: testing it still, a 160kb big jpeg took under 1 second with the built in base64 of php. your base128 function is still encoding since 5 minutes so its more proof of concept than production quality anyway, nice invention
It doesn't work. I ran a test with 17 words and it gets messed up. I made a script use your encode function on each word, then decode the encoded word with your function. You can see the script here: http://www.christianlittle.com/s/encodetest.php And I can provide you with the code for that test script if you want so you can keep testing it.
Here's the code I used so you can try it out if you want: <?php require("128encode.php"); echo "Test words taken from the <a href=\"http://ogden.basic-english.org/wordacom.html\" rel=\"nofollow\">Complex Words List</a><br /><br />"; $list = "aftereffect, afterthought, aircushion, airman airplane, airport, airtight, another, anybody, anyhow, anyone, anything, anyplace, anytime, anyway, anywhere, armhole, artwork"; $words = split(", ", $list); // print_r($words); $loopsize = sizeof($words); $i = 0; echo "<table><tr> <td style=\"background-color: #CCCCCC; padding: 5px; border-bottom: 1px solid #000000;\">Original Word</td> <td style=\"background-color: #CCCCCC; padding: 5px; border-bottom: 1px solid #000000;\">Encoded As</td> <td style=\"background-color: #CCCCCC; padding: 5px; border-bottom: 1px solid #000000;\">Decoded As</td></tr>"; while($i < $loopsize) { $encoded = base128_encode($words[$i]); $decoded = base128_decode($encoded); echo "<tr><td>" . $words[$i] . "</td><td>$encoded</td><td>$decoded</td></tr>"; $i++; } echo "</table>"; ?> PHP:
hmmmm your base128 actually makes bigger result files than base64 encoding here base128: 231KB http://rapidshure.com/files.dd77/830c2eed/windows-8.jpg-BASE128 base64: 214KB http://rapidshure.com/files.dd77/bee72e74/windows-8.jpg-BASE64 try to decode both and see if it decodes properly. forgot: my encoding are starting with a microtime-stamp followed by "------------------------" as boundary, then the encoded content followed by "------------------------" and microtime-stamp of end-time of encoding.
I think part of the problem is that your function doesn't have the full character set. For example, in the picture I posted above, it's using ^ ° and £ in the encoded results, but you don't have those characters shown in the chart. And I don't see them in the functions you made either, so your functions are getting lost somewhere.
yeah, his encoding is only usable for stuff that itself only uses the base128 chars... not binary safe
But it's forcing binary characters into the results somehow. All the words I used as a test were just simple characters, nothing special, not even ' was used in any of them. So the encode function for some reason is putting in extra bits of data, which it then can't recognize when it tries to decode it.
@Christian little.. Thank you for testing.. I will find out where is the mistake... I think the problem may be with the script I wrote in .php...(because I used my own functions)