Question

I have a big string

approx 4000 characters

i want encrypt and decypt it using MD5 because of i want to do convert in a small string please help me a lot of finding i found Base64 but it is not our solution please any one help me

my_string="abcdefghhhhhhhhhhhhhhhhhhhhhh"
      Base64.encode64(my_string)

it gives us very lengthy string.

Was it helpful?

Solution

Encrypting a string will not make it smaller, it will at best be the same length. I think what you are looking for is a way to compress your string. That aside, MD5 is a one-way hashing algorithm, that means that it is designed, so there is now way of recovering the source string (it turns out that it was designed rather poorly).

OTHER TIPS

MD5 is a one-way hash, you can't decrypt it.

To encode a string use Digest::MD5.hexdigest('foobar') but for most purposes I'd say use a better hashing algorithm; MD5 has been broken for a long time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top