Article View: borland.public.jbuilder.java.api
Article #620Re: XOR
From: Kevin Dean
Date: Tue, 27 May 2003 02:02
Date: Tue, 27 May 2003 02:02
40 lines
2195 bytes
2195 bytes
String s = new String(myDecryptedBytes);
--
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:3ed2640b@newsgroups.borland.com...
> 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:
<3ed2c76b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-lond.gip.net!easynet-thlon3!easynet.net!easynews.net!newsfeed3.easynews.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3ed2640b@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-26 19:10:59 PST From: "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> Newsgroups: borland.public.jbuilder.java.api References: <3ed2640b@newsgroups.borland.com> Subject: Re: XOR Date: Mon, 26 May 2003 22:02:20 -0400 Lines: 42 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.124.148 Message-ID: <3ed2c76b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054001003 64.228.124.148 (26 May 2003 19:03:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-lond.gip.net!easynet-thlon3!easynet.net!easynews.net!newsfeed3.easynews.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail