Re: TripleDES output size
- From: Arturo Buonanni <leave_this_out_deer.chief.this.also@xxxxxxxxx>
- Date: Tue, 10 Oct 2006 10:00:00 +0200
On Mon, 9 Oct 2006 12:15:07 -0500, "Joe Kaplan"
<joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
It depends on how you are converting your string data to binary (what
encoding) and how you are converting your binary cipher data back to a
string.
If you are using UTF-8 for converting string to binary (generally a good
idea), then the downside there is that the binary data can be variable
length, depending on the characters in the string. If you use Unicode
encoding, then you should always get two bytes per character.
Then, you can figure out how many bytes of cipher data you'll get by
rounding up to the block size.
If you convert from your binary data to string with Base64 (which is
probably the best way to go, as it is smaller than hex string and won't
result in lossy conversion), then the base64 string will be 4/3 the size of
the binary data.
Make sense?
It makes perfect sense. Thanks.
I indeed use unicode encoding to feed the encryption provider and then
convert the binary data to string with Base64. It turns out to be:
CipherTextLength = _
((((Trunc((PlainTextLength * 2) \ 8) + 1) * 8) \ 3) + 1) * 4
The problem is that only now I realize I'm making my strings quite
big...:-(
Anyway, as I need to use Italian character set, I think I'm forced to
use at least UTF-8. In that case I should howerver consider the worst
case in wich every character of my string is a 2 byte code so I end up
having field the same size as using Unicode. :-(
Are you just trying to decide how big to make your columns in SQL given
input strings of a certain length?
That's exactly what I'm trying to do.
Thanks for your help.
Joe K..
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
- Follow-Ups:
- Re: TripleDES output size
- From: Valery Pryamikov
- Re: TripleDES output size
- From: Joe Kaplan
- Re: TripleDES output size
- References:
- TripleDES output size
- From: Arturo Buonanni
- Re: TripleDES output size
- From: Valery Pryamikov
- Re: TripleDES output size
- From: Arturo Buonanni
- Re: TripleDES output size
- From: Joe Kaplan
- TripleDES output size
- Prev by Date: RE: Help me to understand Code Access Security. I don't get it.
- Next by Date: RE: Help me to understand Code Access Security. I don't get it.
- Previous by thread: Re: TripleDES output size
- Next by thread: Re: TripleDES output size
- Index(es):
Relevant Pages
|