in reply to Re^3: Java to perl conversion
in thread Java to perl conversion

No,

One probably won't need to, but I have to match an API cipher
To explain

The encryption cipher from JAVA is out of my hands and generated by an API
I somehow need to match the same cipher in perl

JAVA CODE to generate the Cipher
String key = "just a bunch of text"; byte[] bytes = new byte[256]; byte[] kbytes = key.getBytes(); for (int i = 0; i < bytes.length; i++) { if (i < kbytes.length) { bytes[i] = kbytes[i]; } else { bytes[i] = (byte) i; } } byte[] md5digest = md5DigestAsBytes(bytes); try { theGeneratedKey = Twofish_Algorithm.makeKey(md5digest); blockSize = Twofish_Algorithm.blockSize(); catch (java.security.InvalidKeyException ike) { throw new Exception(Exception.E_SECURITY, "Invalid security key ' +" + new String(md5digest) + "'", ike); }
Question should read:
I need to match the exact same cipher in Perl
to be able to utilize Crypt::Twofish and decrypt the data. How can I do this in Perl

This is my first post here.

Replies are listed 'Best First'.
Re^5: Java to perl conversion
by Anonymous Monk on May 31, 2013 at 10:31 UTC

    No, One probably won't need to, but I have to match an API cipher ... :) repeat with emphasis

    so are you going to post some data, or do we have to install java to generate some?