Rifts Posted April 16, 2014 Share Posted April 16, 2014 I have a really long string I need to shorten then revert it back to the long string. how can I do this? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 16, 2014 Share Posted April 16, 2014 look at the zip functions. they basically sample the data and convert repeated sections into shorter codes, then reverse the process to get the original data back. Quote Link to comment Share on other sites More sharing options...
Rifts Posted April 16, 2014 Author Share Posted April 16, 2014 there isnt a way to create like a short hash or something that can be reversed? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 16, 2014 Share Posted April 16, 2014 (edited) nope. hashes are one way. any sort of cryptography encoding/decoding produces longer data than the source, as does base64 encoding/decoding. the only way to shorten long data is to find repeated sections that are long enough and occur frequently enough to justify processing them, store one copy of the repleted section along with a short token value, then replace each repeat region with the short token. reverse to get back the original. edit: see the lossless sections at this link - http://en.wikipedia.org/wiki/Data_compression Edited April 16, 2014 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Rifts Posted April 16, 2014 Author Share Posted April 16, 2014 man that sucks lol Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 16, 2014 Share Posted April 16, 2014 what is it that you are trying to solve, as there may be other ways to accomplish the same thing? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.