Comments (7)
Can you show your code?
from jssha.
I'm just copy and pasting in the demo.
On Mar 18, 2014 6:59 AM, "NobleUplift" [email protected] wrote:
Can you show your code?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-37935153
.
from jssha.
If you compute a hash and copy it back into the input field, it will result in a different result than rounds of hashing. This is because the data is finalized to give you that hash value, so you aren't taking a hash and doing another round of iteration on it; you are taking what jsSHA believes is just a string and hashing it. Actually, if you did hash, finalize, rehash, finalize, etc., it puts a huge load on the JavaScript engine and won't make it past 1000 rounds.
from jssha.
Oh is this normal? I'm pretty sure other places do it my way? Which is
slower but "universal"?
On Mar 18, 2014 7:31 AM, "NobleUplift" [email protected] wrote:
If you compute a hash and copy it back into the input field, it will
result in a different result than rounds of hashing. This is because the
data is finalized to give you that hash value, so you aren't taking a hash
and doing another round of iteration on it; you are taking what jsSHA
believes is just a string and hashing it. Actually, if you did hash,
finalize, rehash, finalize, etc., it puts a huge load on the JavaScript
engine and won't make it past 1000 rounds.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-37938917
.
from jssha.
Noble got the explanation 99.9% correct. The issue is I don't believe you're dealing with your first round output correctly.
Round 1
Input -> ASCII string of test (74657374 in hex)
Output -> A hex encoded string of ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff
Your Round 2
Input -> ASCII string of ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff (6565323662306464346166376537343961613161386565336331306165393932336636313839383037373265343733663838313961356434393430653064623237616331383566386130653164356638346638386263383837666436376231343337333263333034636335666139616438653666353766353030323861386666 in hex)
Output -> 5797448d5c775085bc82b808b9d01bb4ef795dfd05ea377d9b537d5e3495179f0b0c03f372518209db3dfbdae47c8529412ce9154dd1c5b99932cdf3b079c125
My Round 2
Input -> hex string of ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff
Output -> faadcaf60afd35dfcdb5e9ea0d0a0531f6338c62187cff37a1efe11f1d41a34879731bc9db49df75aecf5d582ad09b5c6ded2d86bd1f07c11bd755d1fccc81fe
So I don't think you're calculating Round 2 right. If you want to emulate what the library is doing, set the initial input to TEXT, output to hex and then set round 2 input as hex.
from jssha.
Oh so the iterations stay in binary. My concern is the ability to test the
iterations manually without a binary input or output. I guess that's a
personal concern though. I just want to be sure I can duplicate the hashing
if this library disappears.
On Mar 18, 2014 11:25 AM, "Brian Turek" [email protected] wrote:
Noble got the explanation 99.9% correct. The issue is I don't believe
you're dealing with your first round output correctly.Round 1
Input -> ASCII string of test (74657374 in hex)
Output -> A hex encoded string of
ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ffYour Round 2
Input -> ASCII string of
ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff
(6565323662306464346166376537343961613161386565336331306165393932336636313839383037373265343733663838313961356434393430653064623237616331383566386130653164356638346638386263383837666436376231343337333263333034636335666139616438653666353766353030323861386666
in hex)
Output ->
5797448d5c775085bc82b808b9d01bb4ef795dfd05ea377d9b537d5e3495179f0b0c03f372518209db3dfbdae47c8529412ce9154dd1c5b99932cdf3b079c125My Round 2
Input -> hex string of
ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ffOutput ->
faadcaf60afd35dfcdb5e9ea0d0a0531f6338c62187cff37a1efe11f1d41a34879731bc9db49df75aecf5d582ad09b5c6ded2d86bd1f07c11bd755d1fccc81fe—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-37969801
.
from jssha.
Closing this as it seems to be solved.
from jssha.
Related Issues (20)
- Method chaining when using `update` HOT 7
- Typescript build error HOT 2
- Types are packaged/exposed incorrectly HOT 2
- Can SM3 be supported? 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.