Re: UTF-8 Hashing

2009-04-24 Thread starryrendezv...@gmail.com
Right, this seems to work very well. I consider it solved. Here is the corrected code: hash: function(str,method) { var converter = Components.classes["@mozilla.org/intl/ scriptableunicodeconverter"].createInstance (Components.interfaces.nsIScriptableUnicodeConverter); converter

Re: UTF-8 Hashing

2009-04-24 Thread starryrendezv...@gmail.com
On Apr 23, 3:39 pm, Jean-Marc Desperrier wrote: > Nelson B Bolyard wrote: > > Is that python code?  I thought it was JavaScript. > > Yes, you're right, I had a really too quick look at it :-) On a second thought, I just had a look at this page: https://developer.mozilla.org/En/NsICryptoHash Where

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) {

UTF-8 Hashing

2009-04-22 Thread starryrendezv...@gmail.com
I got a bug filed for my extension, since I am using the native hash functionalities right from the XPCOM (@mozilla.org/security/hash;1) without any code from me between it, I wonder how to solve this: md5 hash a UTF-8 encoded string: "您好"(it means "hello" in Chinese), it yields a different resul