Giter Site home page Giter Site logo

Comments (9)

gerwinbrunner avatar gerwinbrunner commented on May 29, 2024

I tried it with the latest version (v1.42) and the problem still persists.
If I remove all the Üs from the string then the hashing is fine again and ok.

Very strange ...

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

Admittedly I'm not surprised that the Unicode support is a little glitchy. Are you setting charWidth = 16 in the jsSHA constructor?

from jssha.

gerwinbrunner avatar gerwinbrunner commented on May 29, 2024

I did not... :(
With the charWidth set to 16 I get a different Hash (7335848e6bccbb75103cf0068b2cc216c817e289) but it is still not the correct one :(

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

So I used Python 3.2 to come up with the hash of your string and it shows that jsSHA's output is correct. Here are the steps I took:

Encoding your string as UTF-16be:
0041004d004f0055004e0054003d003100320033003000300078003300680077006900680059002d00630069005d006900dc006b002a006d00430055005200520045004e00430059003d0045005500520078003300680077006900680059002d00630069005d006900dc006b002a006d004c0041004e00470055004100470045003d00640065005f004400450078003300680077006900680059002d00630069005d006900dc006b002a006d004f005200440045005200490044003d0047002d00320030003100330030003100320038002e00310032003000360078003300680077006900680059002d00630069005d006900dc006b002a006d00500053005000490044003d0066006f0074006f007300630068006f0062006500720078003300680077006900680059002d00630069005d006900dc006b002a006d
As Base-64:
AEEATQBPAFUATgBUAD0AMQAyADMAMAAwAHgAMwBoAHcAaQBoAFkALQBjAGkAXQBpANwAawAqAG0AQwBVAFIAUgBFAE4AQwBZAD0ARQBVAFIAeAAzAGgAdwBpAGgAWQAtAGMAaQBdAGkA3ABrACoAbQBMAEEATgBHAFUAQQBHAEUAPQBkAGUAXwBEAEUAeAAzAGgAdwBpAGgAWQAtAGMAaQBdAGkA3ABrACoAbQBPAFIARABFAFIASQBEAD0ARwAtADIAMAAxADMAMAAxADIAOAAuADEAMgAwADYAeAAzAGgAdwBpAGgAWQAtAGMAaQBdAGkA3ABrACoAbQBQAFMAUABJAEQAPQBmAG8AdABvAHMAYwBoAG8AYgBlAHIAeAAzAGgAdwBpAGgAWQAtAGMAaQBdAGkA3ABrACoAbQ==

Output Hash:
7335848e6bccbb75103cf0068b2cc216c817e289
As Base-64:
czWEjmvMu3UQPPAGiyzCFsgX4ok=

Could you find where things diverge?

from jssha.

gerwinbrunner avatar gerwinbrunner commented on May 29, 2024

I did the following:
http://www.opinionatedgeek.com/dotnet/tools/base64encode/

encoded the above string directly to base 64:
QU1PVU5UPTEyMzAweDNod2loWS1jaV1pw5xrKm1DVVJSRU5DWT1FVVJ4M2h3aWhZLWNpXWnDnGsqbUxBTkdVQUdFPWRlX0RFeDNod2loWS1jaV1pw5xrKm1PUkRFUklEPUctMjAxMzAxMjguMTIwNngzaHdpaFktY2ldacOcayptUFNQSUQ9Zm90b3NjaG9iZXJ4M2h3aWhZLWNpXWnDnGsqbQ

used it with jsSHA and input Base-64 and voila: I got the right Hash (f060a54453131220943e994f7ee7e56482b960fa)
I compare it to is the hash that I get from ogone (payment provider)

when I use the text inputs. I get the values described from above.

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

So the problem is a UTF-8 vs a UTF-16 issue. jsSHA calculates using UTF-16 whereas ogone apparently uses UTF-8.

I hope to get a patch pushed out in the next few hours pending any unforeseen problems

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

I believe the problem should be fixed with the 8e4bbcd commit

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

gerwinbrunner, can you confirm that your issue is fixed? If so, I'll push v1.5 and close this issue.

from jssha.

Caligatio avatar Caligatio commented on May 29, 2024

Closing this issue as fixed.

from jssha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.