Page 1 of 1

sha and encryption

Posted: Wed May 11, 2005 1:07 am
by Calimero
Ok, I know when you encrypt something it's very ugly to read.

But what I don't know is - let's say I have one page of 10 kb I want to encrypt:

How big would it be ( because of size and bandwith usage ) when I encrypt it with
1) sha 128
2) sha 256
...

How does the size varies in relation of encryption algorithm used.

Thanks Ahead !

Re: sha and encryption

Posted: Wed May 11, 2005 6:39 am
by Roja
Calimero wrote: How does the size varies in relation of encryption algorithm used.
A couple of issues with your question.

First, sha isn't encryption. Its a hashing function. You give it a variable length input (from 1 byte to billions of bytes), and it always gives a consistent length output.

The output cannot be "decrypted", and it does NOT contain all the information from the input.

Think of it like a fingerprint: While my fingerprint can identify who I am, the fingerprint is NOT me.

The second issue is that there is no sha128. There is sha1 (which is 160 bits), and sha-256 (which is 256 bits). They are commonly expressed/displayed in Hex, which results in a 40 character length for sha1, and 56 for sha-256.

Posted: Wed May 11, 2005 12:47 pm
by Calimero
ok, sorry - noob in this theme.


So to ask again - if the encryption (real encryption) is used - is the encrypted material much larger then the original

Posted: Wed May 11, 2005 1:16 pm
by Roja
Calimero wrote:ok, sorry - noob in this theme.
Everyone is a beginner at some point. No need to apologize. Thats what these forums are here for - for all of us to learn.

(I'm willing to bet that I'm not the most knowledgable person here about encryption)
Calimero wrote: So to ask again - if the encryption (real encryption) is used - is the encrypted material much larger then the original
It might be, or it might not.

*Most* types of encryption do indeed end up larger than the source material. However, it is usually a fairly low overhead (5-15% larger).

It can happen that it won't be, for a variety of reasons, including some encryption methods that also do compression.

So, "It depends". Which encryption method, what size input, etc etc.

...

Posted: Wed May 11, 2005 2:54 pm
by Calimero
so 5 - 15 %, thanks, I needed a rough figure.


Thanks Again.

Posted: Fri May 13, 2005 8:19 am
by Maugrim_The_Reaper
Even if it is larger - you may be able to run it through gzip compression using PHP. Depends on your actual intentions for use...