Comments (9)
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.
Admittedly I'm not surprised that the Unicode support is a little glitchy. Are you setting charWidth = 16 in the jsSHA constructor?
from jssha.
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.
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.
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.
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.
I believe the problem should be fixed with the 8e4bbcd commit
from jssha.
gerwinbrunner, can you confirm that your issue is fixed? If so, I'll push v1.5 and close this issue.
from jssha.
Closing this issue as fixed.
from jssha.
Related Issues (20)
- Method chaining when using `update` HOT 7
- Typescript build error HOT 2
- Types are packaged/exposed incorrectly HOT 2
- Feature request: HKDF would be nice HOT 1
- Feature Request: KangarooTwelve and MarsupilamiFourteen HOT 6
- ESM package for jssha HOT 1
- How to generate the SHA3-256 hash? HOT 1
- Encrypt sha256 in c# and make it the same key HOT 4
- 43106983S HOT 1
- setHMACKey with B64 HOT 4
- Error when i create jsSHA object HOT 24
- Performance HOT 12
- Package exports do not define a valid '.' target HOT 6
- Recreate internal state HOT 6
- SCRIPT:1002 Syntax Error HOT 3
- Question : How to reset / clear for another hash? HOT 2
- Installing this package via a <script> tag HOT 2
- Deno support documentation
- Reading custom amount of bytes with SHAKE HOT 2
- Incorrect project website in README.md HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jssha.