Integrated compressor

I have witnessed how the ADB bot compresses some attachments,
and it occurred to me to think because delta doesn’t have an integrated compressor, which automatically compresses some attachments.

I think this would allow for significant data savings and increased speed.

Please elaborate. do you mean the html compression of @adbenitez’s simplebot?

Delta Chat compresses media, but it happens in the UI, not core code. So bots have to do their own compression.

If encryption is used, OpenPGP deflate (ZIP) compression is done in the core, though.

2 Likes

Are you sure it’s not re-encoding images? Using a lower quality jpeg setting which is itself horrifically imprudent.

The question is likely about LOSSLESS compression to reduce data use – at the expense of electricity use via higher cpu costs.

wasn’t image compression moved to core since some weeks now?
(UPDATE: I realized it is an old reply)

would it make sense to use Content-Encoding compression to compress emails?

OpenPGP already compresses the message losslessly before encryption, but after encryption the message is base64-encoded. We can hardly do anything about it, because other encodings for OpenPGP are not standardized. There is a binary MIME content-transfer-encoding, but it is not widely supported and can’t be used to re-encode OpenPGP messages: OpenPGP messages are not using base64 Content-Transfer-Encoding, but ASCII-Armoring instead. OpenPGP message is basically a text message starting with -----BEGIN PGP MESSAGE-----, not a binary file. On TLS level compression is deprecated for security reasons, because of BREACH and similar attacks.

As a result, we end up with gzip compression + 33% base64 overhead.

1 Like

if a message was sent as an attachment, did it open the possibility of decreasing the size of the emails?

“Attachment” is just a special type of MIME part, it does not matter whether OpenPGP message is sent as a first part, attachment or anything else. The only ways to decrease message payload size further is to replace ASCII armoring with binary encoding (not specified by OpenPGP) or to use better compression instead of gzip.

And if instead of trying to convert ASCII to binary encoding, convert ASCII to utf8 or utf32.

in this test I achieved a saving of 25% in the message size

Thinking about it I did this little demonstration
repl.it/talk/share/hash-to-utf/126759

var a = 'a';
var z = 'z';
// Convertendo em hex
var a_hex = a.charCodeAt(0).toString(16)
console.log("a: ", a_hex)
var z_hex = z.charCodeAt(0).toString(16)
console.log("z: ", z_hex)
// Concat dos hex
var az_hex = a_hex+z_hex
// Tranformado em numero
var az_int = parseInt(az_hex, 16)
// Convertando hex em char
var res = String.fromCharCode(az_int)
console.log("char",res)
// Converter char em hex
var res_hex = res.charCodeAt(0).toString(16)
console.log("char to hex: ",res_hex)
// Pega duas primeira letras do hex e tranforma em int
var a_char = parseInt(res_hex[0]+res_hex[1], 16)
// Pega duas ultimas letras do hex e tranforma em int
var z_char = parseInt(res_hex[2]+res_hex[3], 16)
// Tranforma cada numero em char junta numa string
var az_char = String.fromCharCode(a_char)+String.fromCharCode(z_char)
console.log("origem: ",az_char)

There is already an yEnc encoding doing this. The problem is not that it’s impossible to do, but that it is non-standard and incompatible to other email clients such as K-9 Mail and Thunderbird.

2 Likes