S
S
svetlov972017-06-12 00:44:49
Data compression
svetlov97, 2017-06-12 00:44:49

How can I encrypt/encode a string?

There is a line like

$a = "hoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoRhoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoRhoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoR";

Is it possible to somehow encrypt / encode it so that it takes up less space? I settled on what can be done like this:
$a = "hoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoRhoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoRhoFZAucasdbhqcIwyuPNluIAdNTSyLtaYWIwrhHgRUZmfLoR";
$a = md5($a);

but rested on the fact that there is no method like md5_decode (). is there another way?
PS do not hit with slippers, I'm a noob

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
15432, 2017-06-12
@15432

It's called "archiving". Encryption does not reduce the size. See data compression algorithms starting with simple ones (RLE, arithmetic coding, LZ* algorithms). Of the simple ready-made options - zlib. For short strings, like yours, compression rarely gives a win, it makes sense to compress large data sets such as books, images, videos. By the way, the string is in base64 format. If you leave it in its original form (a set of bytes), it will take up less space (but you will not be able to transfer it via HTTP).
MD5 is a hash sum, moreover, it is irreversible. Moreover, several different data sets can give the same hash sum. So this is definitely not your case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question