Robert,
I analyzed your Java code and it does a little bit different thing like you
are doing in Rebol. Here is the equivalent:
my-port: make port! [
scheme: 'crypt
direction: 'encrypt
key: to-binary
"qachafU&[EMAIL PROTECTED]"
init-vector: to-binary "11111111"
padding: false
]
open my-port
insert my-port join to-binary "test test test" #{2020}
update my-port
value: copy my-port
Which is yielding the same result as Java.
You are using some padding algorithm in the case of Java code.
Cyphre
----- Original Message -----
From: "robert w dumond" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 08, 2005 8:00 PM
Subject: [REBOL] oops...
> Um... not sure what happened to my Java code, but here is the correct
> and working version. Sorry about that.
>
> Thanks,
> rwd
>
>
>
>
> -- Attached file included as plaintext by Ecartis --
> -- File: Test.java
>
> import BlowfishJ.*;
>
> public class Test {
> public static void main(String[] args) {
> byte[] key =
"qachafU&[EMAIL PROTECTED]".getBytes(
);
> byte[] value = "test test test".getBytes();
> byte[] messbuf;
> int nMessSize = value.length;
>
> int nRest = nMessSize & 7;
>
> if(nRest != 0) {
> messbuf = new byte[(nMessSize & (~7)) + 8];
> System.arraycopy(value, 0, messbuf, 0, nMessSize);
> for(int nI = nMessSize; nI < messbuf.length; nI++) {
> messbuf[nI] = 0x20;
> }
> } else {
> messbuf = new byte[nMessSize];
> System.arraycopy(value, 0, messbuf, 0, nMessSize);
> }
>
> BlowfishCBC blah = new BlowfishCBC(key, "11111111".getBytes());
>
> blah.encrypt(messbuf);
> String stuff = BinConverter.bytesToBinHex(messbuf);
> System.out.println(stuff);
> }
> }
>
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.