Article View: borland.public.jbuilder.java.api
Article #619XOR
From: C.Roum
Date: Mon, 26 May 2003 18:57
Date: Mon, 26 May 2003 18:57
20 lines
1526 bytes
1526 bytes
Hi,
I'm new to Java. I have an encrypted string which was encrypted with Delphi
routines and saved to my database.
I'm trying to decrypt it by using Java.
I encrypted that string by XOR with an array of bytes. lets say byte[] =
{1,2,3}. How can i decrypt it?
I tried sth like this:
int[] myKey = {1, 2, 3};
byte[] myEncryptedBytes = myEncryptedStr.getBytes();
for (int Index = 1; Index <= EncryptedBytes.length; Index++) {
myDecryptedBytes[Index - 1] = ((myEncryptedBytes[Index - 1] & 0xff) ^
myKey[Index % 3]);
}
how can i convet byte[] myDecryptedBytes to String? So that i can compare it
with my check string.
thanks,
Technical Details
Message-ID:
<3ed2640b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,21822203ad77fe3c,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-05-26 12:01:10 PST From: "C.Roum" <croum@edumail.com> Newsgroups: borland.public.jbuilder.java.api Subject: XOR Date: Mon, 26 May 2003 21:57:36 +0300 Lines: 23 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 NNTP-Posting-Host: 212.98.22.92 Message-ID: <3ed2640b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053975563 212.98.22.92 (26 May 2003 11:59:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed1.earthlink.net!newsfeed.earthlink.net!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail