Home All Groups Group Topic Archive Search About

Negative numbers in encryption key

Author
18 Aug 2005 7:21 PM
Corleen
Hello
I've written a simple .net 1.1 class that uses the cryptography classes to
encrypt/decrypt using DES.  My client just sent me their key which contains
negative numbers for example - byte[] keyBytes = {103, -39, -110, 62, -100,
37, -29, 59};  I know they use Java at their shop which I believe allows this.

I'm not sure how to handle this in my app since I can't put negative numbers
into a byte array.  Can anyone help or direct me to some sample code to
handle this ?

Thanks!!!

Author
19 Aug 2005 6:57 AM
Chris Priede
Corleen wrote:
> key which contains negative numbers for example - byte[] keyBytes =
> {103, -39, -110, 62, -100, 37, -29, 59};  I know they use Java at
> their shop which I believe allows this.  I'm not sure how to handle
> this in my app since I can't put negative numbers into a byte array.

int foo = -1;
byte bar = (byte)foo;
Console.WriteLine(bar);     // prints 255

--
Chris Priede (pri***@panix.com)