Encryption Length

44 views
Skip to first unread message

Michaela Merz

unread,
Jan 12, 2013, 12:01:04 PM1/12/13
to sjcl-d...@googlegroups.com
Hi There:

Thanks fpr providing such a clean, nice library. What puzzles me is the size of an encrypted data block. I understand, that die to padding, each block would be slightly larger, but 2097152 raw bytes give me about 3054641 encrypted bytes - that's about 100k larger.

I modified convenience.js to return the object: return (j._subtract(p, j.defaults)); and handle the objects myself.

The 'ct' object returns

Math.floor(sjcl.bitArray.bitLength(obj[i]))/8) = 3054641 - that's a lot of additional data to be transported on up-/downloads. What am I doing wrong here?

Thanks

Michaela






Mike Hamburg

unread,
Jan 13, 2013, 2:48:20 AM1/13/13
to sjcl-d...@googlegroups.com
How are you doing the encryption and decryption here? There's an input and an output encoding pass. It looks like you disabled the output encoding pass (if you're treating the ct object as a bitArray), but what about the input?

For example, if your input is bytes but you input it as a string, it will be UTF-8 encoded by default before encryption. This will add another byte to every byte whose high bit is set, which will expand your input by about 50%.

-- Mike
Reply all
Reply to author
Forward
0 new messages