Jo Smo Jo Smo - 8 months ago 43
MySQL Question

Which hashing method should I use for large text? - PHP / MYSQL

Most of the text stored in my DB is from 1MB to 1.5MB big. But not bigger then 1.5MB, because that's the limit I set.

Here are my needs:

  • I need it for lowering my mysql database size

  • I need it to be as fast as possible

  • no security needed

  • it must just work correctly, so that string_1 and string_2 can never have the same hash

I use PHP and MYSQL.

Answer Source

A Hash is not revirsable, you can make a 1.5mb large text into a small string with the help of hashing, but you can not make the same hash back into the text.

What you are looking for is a Compression algorithm. You can make the files alot smaller with compression, but unlikely the size of a hash.