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.

Était-ce utile?

La 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).

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top