简体   繁体   中英

128 bit reversible encryptor/hasher to reduce DB size

Is there anything out there for PHP that can hash/encrypt a long string into a 128 bit string that can also be reversed?

I am trying importing hundreds on millions of strings into a MySQL DB and the average string is over 100 characters, MD5 gets this down to 32 characters which significantly reduces storage however I cannot reverse this again in my application.

Does PHP have anything available that can handle this?

If I understand your question correctly, it seems to me you mix up hashing and compression quite a lot.

Most hash-functions are not easily reversible, because that is not their purpose. There are infinite "Strings/ByteStreams/Numbers/..." that correspond to the result of a hash-function. As you may know, even images that are a few Gigabytes big, also give you an md5sum of 32 characters.

You can not just magically map any String into a String of fixed length that is shorter, to just be able to magically pouff it back to its original String.

It may well be, that some hash-functions could very efficiently be used to reverse their process if you know that your target results have to have this and that property (in you case maybe character-length of 100-120), but I doubt it.

Or do I totally misunderstand and you just mean ASCII-Strings with the expression "128 bit string"?

不,您不能这样做: 鸽洞原理

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM