starryrendezv...@gmail.com wrote, On 2009-04-22 07:40:
> If it helps, here is the code I currently utilize;

[snip]

I suspect (that is, guess) that your problem is at one of these two places:

1. Perhaps the following code does not pass the UTF8 string you expect it
to pass to the hash algorithm.  Maybe it's passing UTF16.  Maybe it's
including a trailing NUL character, or maybe it's not.  Any of these
differences may explain why the results you get from this javascript do not
match results you get from other programs.

>          var charcodes = [];
>          for (var i = 0; i < str.length; i++){
>                charcodes.push(str.charCodeAt(i));
>          }
>          hash_engine.update(charcodes, str.length);


2. Perhaps the type returned by hash_engine.finish is the the type expected
by TOOLS.convert('bin2hex'

>          return TOOLS.convert('bin2hex',hash_engine.finish(false));
>       },

If you want further help with this, I suggest that you do these things:

A. Create a small html page containing a minimal javascript script that
is complete enough to reproduce it.  It must include sample input.  This
should be no more than twice as big as the sample code you sent us before.

B. Send us that page (paste it as text inline in a plain-text posting)
along with a description of the expected output and the actual output.
It would be good for you to also include the hexadecimal values for
the UTF8 string that you believe is equivalent to your sample input.

-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to