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.

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top