Re: UTF-8 Hashing

2009-04-22 Thread starryrendezv...@gmail.com
If it helps, here is the code I currently utilize; hash: function(str,method) { var hash_engine = Components.classes[@mozilla.org/security/hash; 1].createInstance().QueryInterface (Components.interfaces.nsICryptoHash); switch(method) {

Re: UTF-8 Hashing

2009-04-22 Thread Nelson B Bolyard
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.

Re: UTF-8 Hashing

2009-04-22 Thread Jean-Marc Desperrier
starryrendezv...@gmail.com wrote: hash: function(str,method) { [...] str.charCodeAt(i) python quite probably outputs the value of str.charCodeAt(i) as some variant of a UTF-16 value. Or UCS-2 with no handling of surrogates. Under which format is the string inside the file that md5sum

Re: UTF-8 Hashing

2009-04-22 Thread Nelson B Bolyard
Jean-Marc Desperrier wrote, On 2009-04-22 12:17 PDT: starryrendezv...@gmail.com wrote: hash: function(str,method) { [...] str.charCodeAt(i) python quite probably outputs the value of str.charCodeAt(i) as some variant of a UTF-16 value. Or UCS-2 with no handling of surrogates. Under

Re: UTF-8 Hashing

2009-04-22 Thread Mook
starryrendezv...@gmail.com wrote: If it helps, here is the code I currently utilize; hash: function(str,method) { var hash_engine = Components.classes[@mozilla.org/security/hash; 1].createInstance().QueryInterface (Components.interfaces.nsICryptoHash); var