🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #622

Re: XOR

#622
From: Kevin Dean
Date: Tue, 27 May 2003 13:47
42 lines
2448 bytes
If you're doing pure bit manipulation, there shouldn't be any sign problems.
However, because all operations are of type int, you can just cast the
result back to byte as follows:

for (int Index = 1; Index <= EncryptedBytes.length; Index++) {
  myDecryptedBytes[Index - 1] =  (byte)((myEncryptedBytes[Index - 1] &
0xff);

-- 
Check out our latest white papers at
http://www.datadevelopment.com/papers/index.html

BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server

Dolphin Data Development Ltd.
http://www.datadevelopment.com/

"C.Roum" <croum@edumail.com> wrote in message
news:3ed31980@newsgroups.borland.com...
> Hi,
>
> I'm trying to decrypt sth like:
>  for (int Index = 1; Index <= EncryptedBytes.length; Index++) {
>        myDecryptedBytes[Index - 1] =  ((myEncryptedBytes[Index - 1] &
0xff)
>
> but i get "Error #: 355 : possible loss of precision: int, required: byte"
> error.
>
> actually myKey values are greater than 128 and I couldnt define myKey
values
> as byte[].
> java's byte is -128 to +128. Delphi's byte is 0..256. I think problem
arises
> from that point.
> How can i decrypt a String which is UTF8 encoded by using XOR with a key
> values which are greater than 128? Then finally decrypted array should be
> converted to String.
> Is it possible?
>
>
Technical Details
Message-ID: <3ed36cf0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ed2640b@newsgroups.borland.com> <3ed2c76b$1@newsgroups.borland.com> <3ed31980@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,21822203ad77fe3c
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-05-27 07:08:21 PST
From: "Kevin Dean" <NkOdSePaAnM@datadevelopment.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3ed2640b@newsgroups.borland.com> <3ed2c76b$1@newsgroups.borland.com> <3ed31980@newsgroups.borland.com>
Subject: Re: XOR
Date: Tue, 27 May 2003 09:47:19 -0400
Lines: 44
Organization: Dolphin Data Development Ltd.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 64.228.123.174
Message-ID: <3ed36cf0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054043376 64.228.123.174 (27 May 2003 06:49:36 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail