|
Science Forum Index » Cryptography Forum » Cipher Length with Rijndael
Page 1 of 1
|
| Author |
Message |
| Jeff Kanel |
Posted: Wed Dec 31, 2003 12:58 pm |
|
|
|
Guest
|
I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
Thanks!
Jeff Kanel |
|
|
| Back to top |
|
| Jean-Luc Cooke |
Posted: Wed Dec 31, 2003 1:11 pm |
|
|
|
Guest
|
Jeff, I'll assume you're using CTR or CBC mode.
encLength = 16*((inputLength + 15) /16);
values are in bytes
JLC
Jeff Kanel <jkanel_ng@yahoo.com> wrote:
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
Thanks!
Jeff Kanel
-- |
|
|
| Back to top |
|
| Jean-Luc Cooke |
Posted: Wed Dec 31, 2003 1:11 pm |
|
|
|
Guest
|
Jeff, I'll assume you're using CTR or CBC mode.
encLength = 16*((inputLength + 15) /16);
values are in bytes
JLC
Jeff Kanel <jkanel_ng@yahoo.com> wrote:
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
Thanks!
Jeff Kanel
-- |
|
|
| Back to top |
|
| Tom St Denis |
Posted: Wed Dec 31, 2003 1:17 pm |
|
|
|
Guest
|
"Jeff Kanel" <jkanel_ng@yahoo.com> wrote in message
news:8d62ab6.0312310958.131f6275@posting.google.com...
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
I don't quite get the question. Rijndael is a bijection which means it
doesn't expand the input at all. 16 bytes in, 16 bytes out.
So for s 32 byte message you'll have 32 bytes of ciphertext. [Even if you
use a mode like CTR you can work that into the scheme so for a group of
messages you need only one IV and you can calc the IV for each message from
the master IV....]
Tom |
|
|
| Back to top |
|
| Tom St Denis |
Posted: Wed Dec 31, 2003 1:17 pm |
|
|
|
Guest
|
"Jeff Kanel" <jkanel_ng@yahoo.com> wrote in message
news:8d62ab6.0312310958.131f6275@posting.google.com...
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
I don't quite get the question. Rijndael is a bijection which means it
doesn't expand the input at all. 16 bytes in, 16 bytes out.
So for s 32 byte message you'll have 32 bytes of ciphertext. [Even if you
use a mode like CTR you can work that into the scheme so for a group of
messages you need only one IV and you can calc the IV for each message from
the master IV....]
Tom |
|
|
| Back to top |
|
| David A. Scott |
Posted: Wed Dec 31, 2003 3:40 pm |
|
|
|
Guest
|
jkanel_ng@yahoo.com (Jeff Kanel) wrote in
news:8d62ab6.0312310958.131f6275@posting.google.com:
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
Thanks!
Jeff Kanel
If your using plain AES CBC with plain padding you always need at most
2 + lenght/16
example 1 to 15 btyes 2 blocks at a length of 16 to 31 you need 3
and so on.
For you example of 32 bytes you would need 4 blocks. However if the
IV block is like a part of key and you don't need to sent it you could
subtract one making it 3 blocks. And if your data is always a multiple
of 16 you really don't need padding in which case you could subtract
another one leavein it 2.
David A. Scott
--
My Crypto code
http://cryptography.org/cgi-bin/crypto.cgi/Misc/scott19u.zip
http://cryptography.org/cgi-bin/crypto.cgi/Misc/scott16u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link" |
|
|
| Back to top |
|
| David A. Scott |
Posted: Wed Dec 31, 2003 3:40 pm |
|
|
|
Guest
|
jkanel_ng@yahoo.com (Jeff Kanel) wrote in
news:8d62ab6.0312310958.131f6275@posting.google.com:
Quote: I'm using Rijndael with a 256-bit key and 128-bit block size.
Can anyone tell me how many bytes I'll need to store in my database
per byte of input?
In other words...if my plain-text is 32 bytes, how many bytes long is
the cipher-text.
I'm sure it's not linear, so can anyone point me to a formula?
Thanks!
Jeff Kanel
If your using plain AES CBC with plain padding you always need at most
2 + lenght/16
example 1 to 15 btyes 2 blocks at a length of 16 to 31 you need 3
and so on.
For you example of 32 bytes you would need 4 blocks. However if the
IV block is like a part of key and you don't need to sent it you could
subtract one making it 3 blocks. And if your data is always a multiple
of 16 you really don't need padding in which case you could subtract
another one leavein it 2.
David A. Scott
--
My Crypto code
http://cryptography.org/cgi-bin/crypto.cgi/Misc/scott19u.zip
http://cryptography.org/cgi-bin/crypto.cgi/Misc/scott16u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link" |
|
|
| Back to top |
|
| Paul Crowley |
Posted: Thu Jan 01, 2004 2:26 pm |
|
|
|
Guest
|
|
| Back to top |
|
| Paul Crowley |
Posted: Thu Jan 01, 2004 2:26 pm |
|
|
|
Guest
|
|
| Back to top |
|
| |