Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

.NET Encryption or Compression come first, small file and encrypted

views
     
TSAnime4000
post Jun 9 2016, 11:16 PM, updated 8y ago

Regular
******
Senior Member
1,917 posts

Joined: Jul 2009
From: /dev/null


I doing some free spare time programming to understanding Data Encryption and Compression..

so...

Encrypt first then Compress?
wKkaY
post Jun 10 2016, 02:30 AM

misutā supākoru
Group Icon
VIP
6,008 posts

Joined: Jan 2003
No. You compress first, then encrypt.

Compression removes redundancy from the input, for example repeated words or phrases.

Encryption scrambles the input so that someone cannot determine from the output, without knowing the key. Good encryption conceals redundancy in the input, so the output it produces is at odds with the ideal input for compression.

Why do you think you should encrypt first?

This post has been edited by wKkaY: Jun 10 2016, 02:32 AM
narf03
post Jun 10 2016, 07:51 AM

Look at all my stars!!
*******
Senior Member
4,544 posts

Joined: Dec 2004
From: Metro Prima, Kuala Lumpur, Malaysia, Earth, Sol


Are u asking chicken or egg 1st ?

sounds like u are asking which technology invented first =P
badai
post Jun 10 2016, 10:48 AM

Enthusiast
*****
Senior Member
986 posts

Joined: Jan 2003
Usually if you encrypt first, your compression won't be good because encryption will remove repetitive block that can be remove during compression. So compress first then encrypt.
badai
post Jun 10 2016, 10:55 AM

Enthusiast
*****
Senior Member
986 posts

Joined: Jan 2003
QUOTE(narf03 @ Jun 10 2016, 07:51 AM)
Are u asking chicken or egg 1st ?

sounds like u are asking which technology invented first =P
*
If egg come first, it will never hatches because it will rot because you need to incubate it. If the egg somehow managed to survive, the chick will never survive without mother hen.

I wonder who come out with this chicken/egg thing and why everybody keep using it. There are other animal like duck that you don't have to incubate the egg and baby duck can survive on their own, yet they still use chicken. Are they all just plain stupid? Are you?

Compress first!! Totally off topic and give wrong analogy using totally wrong example.
stormrage
post Jun 20 2016, 03:56 PM

Getting Started
**
Junior Member
111 posts

Joined: Jan 2003
Compress first then encrypt due to how compression algorithm works by eliminating redundancy and known formats. If you encrypt first such redundancies/known formats won't be there anymore and
resulted in poor compression ratio.

You can read more in details here

iammyself
post Jun 29 2016, 12:59 PM

Getting Started
**
Junior Member
238 posts

Joined: May 2011
There's this article on Hacker News today
that describes potential security issue with compress then encrypt:-

Should you encrypt or compress first?
http://blog.appcanary.com/2016/encrypt-or-compress.html
angch
post Jun 29 2016, 01:12 PM

On my way
****
Junior Member
635 posts

Joined: Jul 2006
QUOTE(iammyself @ Jun 29 2016, 12:59 PM)
There's this article on Hacker News today
that describes potential security issue with compress then encrypt:-

Should you encrypt or compress first?
http://blog.appcanary.com/2016/encrypt-or-compress.html
*
tl/dr: Compress, then encrypt, unless the stuff you use/do have potential for side channel attacks. (e.g. interactive sessions, or repeated requests ala CRIME)

Or just randomly append the results till you get a minimum block size so that's not too far off from your average block size (for your interactive session).

Or just read the HN discussion. Better, more knowledge folks there: https://news.ycombinator.com/item?id=11994286

This post has been edited by angch: Jun 29 2016, 01:13 PM

 

Change to:
| Lo-Fi Version
0.0142sec    0.28    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 07:39 AM