Re: TripleDES output size



Actually, it is possible to securely encrypt a printable string to
another printable string (i.e. no need for base64) without any
expansion at all. The trick is to use cycle-walking ciper mode
(rigorous treatment in paper of Black, Rogaway - Encryption with
Arbitrary Domains) plus some other things that depends on your system
requirement such as maxim length of the string and others. However,
since you are new to cryptography, I would not recommend you to do it
yourself - too high risk of making things wrong.

-Valery.
http://www.harper.no/valery

Arturo Buonanni wrote:
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. :-(

.



Relevant Pages

  • Re: Compress ASCII text as Hex?
    ... There an encoding format code BASE64 (also known as UUEncoding in some ... It take fully binary data and converts it a set of 64 ... characters, so encoded blocks increase 33% in size. ... as long as your "encoded" string meets ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Encrypting Data into a string
    ... Basically, you use Base64 to ... represent arbitrary binary data as a string. ... want to use a text-based encoding such as UTF8 to convert that into binary. ...
    (microsoft.public.dotnet.security)
  • Re: How to pass a vc++ BSTR value to C#.Net
    ... So we might have a suitation where an encryption might take place using COM ... Actually I'm able to return the binary data in the form of BSTR by using ... Encryption of a string doesn't give you another string. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Create a CBitmap from SAFEARRAY
    ... base64 encoded in a array of byte. ... If you have a base-64 encoded string, and you want to decode it, you ... and a reference to a byte buffer. ...
    (microsoft.public.vc.mfc)
  • Re: How to decrypt a string?
    ... converting a string to another string. ... No. Encryption works on binary data, and it's not safe to treat ...
    (microsoft.public.dotnet.framework)