Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top