A compression algorithm that creates secure URL data

I want to store cookie data in a compact form.

Is there such a thing as a compression algorithm that creates a secure URL? Currently my approach

String jsonData = GSON.toJson(data); byte[] cookieBinaryData = jsonData.getBytes("UTF-8"); byte[] cookieSnappyData = Snappy.compress(cookieBinaryData); String cookieBase64Data = new Base64(true).encodeToString(cookieSnappyData); 

From this cookieBase64Data , cookieBase64Data is stored inside the cookie. I would be happy to skip the Base64 host.

+4
source share
2 answers

How much do you save doing this? Is it worth it?

How to simply save the identifier in a cookie and then view all the data in the database? It looks like a long-lived session, but you control what data you store, so there is no huge amount.

+1
source

Not. Compression is often a prefix code rather than an encoding. You can use yEnc encoding to protect some bits. Personally, I don’t know why yEnc is doomed. It uses extended 8-bit ASCII encoding and adds much less overhead (2%) to the compressed data: http://en.wikipedia.org/wiki/YEnc

0
source

Source: https://habr.com/ru/post/1399034/


All Articles