rajesh1486 / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

What components are required for SHA1 to output a hex string? #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm packaging CryptoJS for meteor (www.meteor.com) and I can only get 
CryptoJS.SHA1 to produce a WordArray. toString() produces an [object Object].

Files included were components/core.js, and sha1.js. What else needs to be 
included? MD5, by comparison, outputs a string right away with only core.js and 
md5.js.

Is there a general way to figure that out? The rollup files are minified and a 
pain to grok, and Meteor's policy is to include the un-minified files only.

Original issue reported on code.google.com by ddascale...@gmail.com on 14 Nov 2013 at 9:00

GoogleCodeExporter commented 8 years ago
core.js and sha1.js are the only files needed. If you don't get a hex string 
from toString(), then something very weird is going on, and you should post the 
code that reproduces the issue.

Original comment by Jeff.Mott.OR on 14 Nov 2013 at 9:41

GoogleCodeExporter commented 8 years ago
False alarm, feel free to close.

The error is due to a mismatch that occurs between versions. With core.js 3.0.2 
and sha1.js (or md5.js for that matter) 3.1.2,

document.write(CryptoJS.SHA1("some-string"))

outputs "[object Object]"

Original comment by ddascale...@gmail.com on 15 Nov 2013 at 11:59

GoogleCodeExporter commented 8 years ago

Original comment by Jeff.Mott.OR on 15 Nov 2013 at 4:06