in reply to Convert Java to Perl -> Script attached

smoky:

You missed having a perfect question by a few items:

  1. What is the Java function returning?
  2. What result are you getting from your Perl function?
  3. What input data are you using?

Add that to your node, and I'm sure you'll get some good feedback. I didn't see anything obvious, except that you seem to be skipping the base-64 encoding after creating your digest. But I've not used UTF encoding, nor Digest::SHA in any of my perl programs, so I'm not sure.

...roboticus
  • Comment on Re: Convert Java to Perl -> Script attached

Replies are listed 'Best First'.
Re^2: Convert Java to Perl -> Script attached
by smoky (Novice) on Mar 03, 2009 at 12:25 UTC
    Hey Roboticus, Thanks for the reply. 1. The java function is returning a String which represents an encoded / encrypted string. The encoding / encryption needs to be perfect to match a legacy system. 2. The Perl program returns a wrong value after trying to SHA the string, I believe. 3. Input data would just be "password"
      What does java myprogram password return? Show the value. Also show what perl myprogram password returns. Wrong value isn't good enough.
      smoky:

      I meant the actual values returned by both the java and perl programs. I can't tell if a change returns the wrong value if I don't know what the right value is. Also, if I were to download your perl program and get it running, I can't tell if it matches the output of the Java program unless I go through the hassle of installing java and getting the java sample to run. By leaving out the java results, you greatly reduce the number of people who are going to bother to try to assist.

      Also, you can often get a hint about a problem based on the data itself without running the program. Some characters couldn't appear in a Base-64 encoding, for example.

      ...roboticus