Re: How good an encryption algorithm is this?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Severian (severian_at_chlamydia-is-not-a-flower.com)
Date: 11/22/04


Date: Mon, 22 Nov 2004 17:33:02 -0500

On Mon, 22 Nov 2004 15:02:33 -0500, "Nicholas Paldino [.NET/C# MVP]"
<mvp@spam.guard.caspershouse.com> wrote:

>Bonj,
>
> See inline:
>
>> 1) Must be capable of encrypting strings to a byte array, and decyrpting
>> back again to the same string
>
> All encryption algorithms do this. If you couldn't decrypt back, then
>it would be a hash.
>
>> 2) Must have the same algorithm work with strings that may or may not be
>> unicode
>
> This should not be an issue. Encryption works on byte streams, not
>strings. As long as the string can be converted to/from a byte stream, you
>won't have a problem.
>
>> 3) Number of bytes back must either be <= number of _TCHARs in *
>> sizeof(_TCHAR), or the relation between output size and input size can be
>> calculated simply. Has to take into account the null terminator on the end
>> of the string.
>
> The null terminator at the end of a string is just another byte. If you
>encrypt it, it's going to take up space. If you don't need it, don't use it
>then. As for the output size, I believe that it is the same as the input
>size.
>
>> 4) Encryption algorithm must also return the exact number of bytes of the
>> encrypted data
>
> Do you mean that it will return the number of bytes it would take to
>encrypt the data? Since most algorithms return the same size, this won't be
>a problem.
>
> I would recommend against rolling your encryption. Rather, you should
>use one of the classes in the System.Security.Cryptography namespace. If
>you need compression as well, then you can apply that after the encryption.

I agree with the first two sentences, but compression should be done
before encryption, since encrypted data does not usually compress
well.

--
Sev


Relevant Pages

  • Re: Byte array to string and back - newbie question
    ... // Create a symmetric algorithm. ... This is done to make encryption more ... // Encrypt a string into a string using a password ... // Decrypt a byte array into a byte array using a key and an IV ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Using Python To Create An Encrypted Container
    ... an encrypted archive utility designed for secure archiving ... A match string allows you to only extract files matching a given ... Encrypt the string s using passwd and encryption cipher enc ...
    (comp.lang.python)
  • Re: How good an encryption algorithm is this?
    ... As long as the string can be converted to/from a byte stream, ... then you can apply that after the encryption. ... > So I decided to invent my own algorithm, and I just wanted anybody's> opinion on how secure this could be compared to the Win32 API version. ... > HCRYPTHASH hCryptHash; ...
    (microsoft.public.vc.language)
  • Length of the data to decrypt is invalid
    ... I found this code on a site for doing string encryption/decryption. ... // Create a symmetric algorithm. ... // This is done to make encryption more secure. ... // This will tell it that we have done our decryption ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Web app security
    ... public static string EncryptToBase64String(string stringToEncrypt, ... we'd also like to move on to better encryption such ... to make the.NET AES encryption to work together with the AES encryption ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)