csacx / crypto-js Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/crypto-js
Automatically exported from code.google.com/p/crypto-js
Due to the way setTimeout forces the browser to wait at minimum 4 ms before
resuming the computation it makes the async pbkdf2 very slow, taking a full 10
seconds with 2000 iterations. I've added a loop forcing it to compute for at
least 100ms before returning to the browser, this gives it speed without much
browser lag:
while (i < iterations && ((new Date()).getTime() - start.getTime()) < 100)
I've attached a copy of the source for reference.
Original issue reported on code.google.com by [email protected]
on 21 Feb 2012 at 6:03
Attachments:
From reading the quick-start guide, it is not obvious that it is using AES-256.
Also, it is not apparent that you can pass an array of bytes as the key. It
looks like you have to pass a string containing a passphrase.
Original issue reported on code.google.com by [email protected]
on 16 Mar 2012 at 9:02
This is a feature request, not an issue.
It would be great if this library also supported RSA signing and validation,
similar to what was done by Kenji Urushima:
http://www9.atwiki.jp/kurushima/pub/jsrsa/
Original issue reported on code.google.com by [email protected]
on 19 Jan 2012 at 11:26
What steps will reproduce the problem?
1. Create a simple html document inside project dir (attached as index.html)
which includes a script tag with src="rollups/pbkdf2.js"
2. Follow steps in the PBKDF2 example
3. Open the javascript console and inspect the contents of each example variable
What is the expected output? What do you see instead?
The output I'm expecting from CryptoJS.PBKDF2 is a hex digest or some sort, but
I get an object.
What version of the product are you using? On what operating system?
v3, OSX Lion
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 May 2012 at 4:22
Attachments:
What steps will reproduce the problem?
1. Call method Crypto.util.hexToBytes(helloHex);
2. With a hex number with uneven number of digits e.g. 3, 5, 7 and so on (12F,
34F52)
3. then the result is not correct since the function reads indata in sets of two
What is the expected output? What do you see instead?
input: 1024
output: [64,0]
should be: [4,0]
What version of the product are you using? On what operating system?
Chrome and 2.5.1
This could be a solution, it might not be perfect but it works
// Convert a hex string to a byte array
hexToBytes: function (hex) {
hex=(hex.length%2==0?"":"0")+hex;
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
}
Original issue reported on code.google.com by [email protected]
on 4 Oct 2011 at 12:58
npm only has 2.5.3
it would be nice to have 3.x in there.
Original issue reported on code.google.com by [email protected]
on 13 Jul 2012 at 7:10
1. Reference
http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js
2. Call CryptoJS.SHA1("Message")
Expected output is a hashed string. Actual output is a JS engine error message:
"Cannot read property 'words' of undefined"
Chrome 19.0.1084.56 m on Windows 7.
Original issue reported on code.google.com by [email protected]
on 21 Jun 2012 at 8:06
Glancing over the source I've noticed that crypto-JS does not seem to support
Javascript typed Arrays
(https://developer.mozilla.org/en/JavaScript_typed_arrays)
Adding support for this would probably speed up the library a bit.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Jun 2012 at 7:01
What steps will reproduce the problem?
1. in an HTML file, include scripts/crypto-md5/crypto-md5.js (from the
latest downloadable zip file)
2. also include scripts/crypto-sha1/crypto-sha1.js
3. the Crypto.MD5 function will not be available (you get an error if you
try to use it)
4. remove scripts/crypto-sha1/crypto-sha1.js
5. the Crypto.MD5 function is now available
What is the expected output? What do you see instead?
I expect to be able to use both the Crypto.MD5 and Crypto.SHA1 (and
Crypto.SHA256) in the same page.
What version of the product are you using? On what operating system?
crypto-js 2.0.0
OS is Linux (Ubuntu 9.10)
Browser = Firefox 3.5.8
Please provide any additional information below.
It seems crypto-sha1.js overwrites the Crypto object, thus removing the
Crypto.MD5 function
This is probably true for all the Crypto.* methods
Original issue reported on code.google.com by [email protected]
on 9 Apr 2010 at 4:43
What steps will reproduce the problem?
1. Create an AES encryptor
2. run .process on data
What is the expected output? What do you see instead?
Expected output is ciphertext; instead, an exception is raised
What version of the product are you using? On what operating system?
Using CryptoJS 3.0.2 with Chrome 20 on OSX 10.7
Please provide any additional information below.
The following code raises the error deterministically for me:
(function(enc) { enc.process('some test data'); enc.process('test');
})(CryptoJS.algo.AES.createEncryptor('a test key'))
Reproduced the error on Safari (expectedly), and Firefox.
Original issue reported on code.google.com by [email protected]
on 13 Jul 2012 at 4:02
What steps will reproduce the problem?
1.
/*** encrypt */
var ciphertext = Crypto.AES.encrypt("plaintext", "Secret Passphrase", { mode:
new Crypto.mode.CTR });
2.
/*** decrypt */
var plaintext = Crypto.AES.decrypt("ciphertext", "Secret Passphrase", { mode:
new Crypto.mode.CTR });
3.
/* outoput error: */
malformed URI sequence 6-a*2);return
j}};n=n.charenc={};n.UTF...rCode(f[b]));return
j.join("")}}})(); <- 2.4.0-...-aes.js (line 10)
What is the expected output?
// encrypt
ciphertext = "UCscqUZ5g%2BfhZD6LcLj5JzHjrIfxxYFIGgX%2F%2FCj24Rg%3D";
// decrypt
plaintext = "plaintext";
What do you see instead?
/* outoput error: */
malformed URI sequence 6-a*2);return
j}};n=n.charenc={};n.UTF...rCode(f[b]));return
j.join("")}}})(); <- 2.4.0-...-aes.js (line 10)
What version of the product are you using?
bug fixed in version 2.5.3
On what operating system?
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101
Firefox/10.0.2
Please provide any additional information below.
Documentation :
http://localhost/crypto/secretkey/doc/doc_aes_cryptojs.html
3 Dic 2011, 12:06 - [ Error encrypt / decrypt CTR ] bug fixed in version 2.5.3
http://groups.google.com/group/crypto-js/browse_thread/thread/6e9685b92c6ca99f?p
li=1
Original issue reported on code.google.com by [email protected]
on 12 Mar 2012 at 4:26
crypto-js v.3.0
Concat function has error:
Uncaught TypeError: Cannot read property 'words' of undefined
Original issue reported on code.google.com by [email protected]
on 13 May 2012 at 9:02
What steps will reproduce the problem?
1. compute has using Crypto.HMAC(Crypto.SHA1, "Message", "Key", { asBytes: true
}); in IE
2. Repeat step (1) in Safari
3. Compare array of bytes
What is the expected output? What do you see instead?
Output should be the same, but they're different.
What version of the product are you using? On what operating system?
Windows Vista Home Edition, IE 8, Safari 5
Original issue reported on code.google.com by [email protected]
on 12 Nov 2010 at 5:02
What I want to do is to encode byte array same way Java ciphers does.
Maybe this is already possible by I can't find a way to do this. I've tried
passing CryptoJS.lib.WordArray but it gives me wrong result or maybe I do not
understand something.
This is what I've tried:
a = CryptoJS.AES.encrypt("message", "aa")
w = Crypto.util.bytesToWords(Binary.stringToBytes("message"));
b = CryptoJS.AES.encrypt(CryptoJS.lib.WordArray.create(w), "aa")
b.toString()
"U2FsdGVkX1+INUiseS5zBc/K2NQv0hVEtXZSn5zb8Vs="
a.toString()
"U2FsdGVkX185LoomoBEmXtZcKxf0CGjz4i+2SyGnAwU="
Should those two be equal?
Original issue reported on code.google.com by [email protected]
on 6 Sep 2012 at 3:52
What steps will reproduce the problem?
1. simple test script for base64 encode/decoder...
What is the expected output? What do you see instead?
-Used text from Wikipedia base64 page; text does NOT match.
Please provide any additional information below.
<!DOCTYPE HTML>
<HTML>
<HEAD>
<META charset="utf-8">
<TITLE>De/Encode string -> BASE64</TITLE>
<SCRIPT src="javascript/crypto/components/core.js"></SCRIPT>
<SCRIPT src="javascript/crypto/components/cipher-core.js"></SCRIPT>
<SCRIPT src="javascript/crypto/components/enc-utf16.js"></SCRIPT>
<SCRIPT src="javascript/crypto/components/enc-base64.js"></SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="javascript">
var nextLine="<BR>";
//http://en.wikipedia.org/wiki/Base64
var strWikiText= "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
var strWikiB64 ="TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=";
/*
var str = '48656c6c6f2c20576f726c6421';
var words = CryptoJS.enc.Hex.parse(str);
var hex = CryptoJS.enc.Hex.stringify(str);
document.writeln(str +nextLine + words +nextLine + hex +"<HR>");
*/
var word8 = CryptoJS.enc.Utf8.parse(strHttp);
document.writeln(word8 +nextLine );
var utf8 = word8.toString(CryptoJS.enc.Utf8);
document.writeln( utf8 +"<HR>");
/*
var str = "AXLBOX";
var hash = CryptoJS.enc.Utf16.parse(str);
var words = hash.toString(CryptoJS.enc.Base64);// use this for the AES key
document.writeln(strHttp +nextLine + str +nextLine + hash +nextLine + words +nextLine);
var encrypted = CryptoJS.AES.encrypt(strHttp, words);
var decrypted = CryptoJS.AES.decrypt(encrypted, words);
document.writeln(nextLine +encrypted +nextLine + nextLine +decrypted +"<HR>");
*/
var wordT = CryptoJS.enc.Base64.parse(strWikiText);
var words = CryptoJS.enc.Base64.parse(strWikiB64);
var base64 = wordT.toString(CryptoJS.enc.Base64);
document.writeln( decode64(strWikiB64) +nextLine + "<HR>");
document.writeln(wordT +nextLine + words +nextLine + base64 +nextLine + "<HR>");
///
/// testing this crypto lib against known values as provided by
http://en.wikipedia.org/wiki/Base64
///
var testString="any carnal pleasure.";
var x=testString.length;
for (x=testString.length; x>testString.length-6; x--) {
var tempStr=testString.substr(0, x);
document.writeln("Input: " + tempStr + " ; Output: " + CryptoJS.enc.Base64.parse(tempStr) +nextLine);
}//end for x
</SCRIPT>
</BODY>
</HTML>
Original issue reported on code.google.com by [email protected]
on 12 Aug 2012 at 1:07
Would be nice to include an implementation of the Whirlpool digest.
Whirlpool is a cryptographic hash function, and furthermore
* is not (and will never be) patented - it may be used free of charge for any purpose
* has been adopted by the International Organization for Standardization (ISO)
* there are no known security weaknesses
Source: http://en.wikipedia.org/wiki/Whirlpool_(cryptography)
I immediately found two existing JavaScript implementations:
* http://etherhack.co.uk/hashing/whirlpool/whirlpool.html
* http://www.sunsean.com/Whirlpool.html
Maybe one of the authors is happy to share their code?
Original issue reported on code.google.com by [email protected]
on 24 Mar 2012 at 11:54
Crypto-JS v2.5.3 is reacting differently on Embed devices (Samsung Smart TV
(sdk 2.XX)) and Desktop/Web
Its reacting differently on Desktop browse and Samsung Smart TV app (basically
a html that is running on TV internal browse, i am not sure about the detail of
the browse).
secret = Crypto.HMAC(Crypto.SHA256, str, key, { asBytes: true });
result = Crypto.util.bytesToBase64(secret);
alert(result); // Different results on Desktop and embed device.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 30 Mar 2012 at 12:25
The UTF16 parser is returning different byte order than my .NET pair.
I have this .NET test which works/describes behavior.
[Test]
public void TestSHA1()
{
var alg = new System.Security.Cryptography.SHA1Managed();
byte[] bytes = new UnicodeEncoding().GetBytes("ax");
Assert.AreEqual("61-00-78-00", BitConverter.ToString(bytes));
byte[] hash = alg.ComputeHash(bytes);
Assert.AreEqual("E7-77-35-54-8D-77-09-2C-87-B8-30-3E-9F-55-1A-3A-48-B8-0A-A6", BitConverter.ToString(hash));
string base64String = Convert.ToBase64String(hash);
Assert.AreEqual("53c1VI13CSyHuDA+n1UaOki4CqY=", base64String);
}
This is the same data and expectations in Jasmine unit test
describe('CryptoJS test', function () {
describe('SHA1', function () {
it('should match .NET version', function () {
var passwd = CryptoJS.enc.Utf16.parse('ax', true);
expect(passwd.toString()).toBe('61007800');
var hash = CryptoJS.SHA1(passwd);
var hex = CryptoJS.enc.Hex.stringify(hash);
expect(hex).toBe('e77735548d77092c87b8303e9f551a3a48b80aa6');
var base64 = CryptoJS.enc.Base64.stringify(hash);
expect(base64).toBe('53c1VI13CSyHuDA+n1UaOki4CqY=');
});
});
});
Most likely you would like to introduce another encoding or parameter to allow
different byte order. Patch for enc-utf16.js
/**
* Converts a UTF-16 string to a word array.
*
* @param {string} utf16Str The UTF-16 string.
* @param {bool} littleEngian byte order
*
* @return {WordArray} The word array.
*
* @static
*
* @example
*
* var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
*/
parse: function (utf16Str, littleEngian) {
// Shortcut
var utf16StrLength = utf16Str.length;
var le = (typeof littleEngian === "undefined") ? false : littleEngian;
// Convert
var words = [];
for (var i = 0; i < utf16StrLength; i++) {
var ch=utf16Str.charCodeAt(i);
if(le){
ch=ch>>>8|((ch&0xFF)<<8);
}
words[i >>> 1] |= ch << (16 - (i % 2) * 16);
}
return f.create(words, utf16StrLength * 2);
}
What version of the product are you using? On what operating system?
3.0.2, chrome 21
Original issue reported on code.google.com by pavel.savara
on 7 Sep 2012 at 3:40
What steps will reproduce the problem?
Details of the problem can be found in this stackoverflow.com question:
http://stackoverflow.com/questions/11268307/should-all-implementations-of-pbkdf2
-generate-the-the-same-key-from-identical-in
What is the expected output? What do you see instead?
CryptoJS's pbkdf2 output should match that of Node.js crypto.pbkdf2.
What version of the product are you using? On what operating system?
CryptoJS v3.0.2 on Windows 7 x64
Original issue reported on code.google.com by [email protected]
on 29 Jun 2012 at 8:59
What steps will reproduce the problem?
1. Call Crypto.MD5() with a string larger than 4000 characters
What is the expected output? What do you see instead?
The returned MD5 hash string is the correct length, however every character
is a zero.
What version of the product are you using? On what operating system?
Crypto-JS v1.1.0, Firefox 3.5, Windows XP Pro
Original issue reported on code.google.com by [email protected]
on 16 Sep 2009 at 4:04
I have ported an implementation of the TwoFish algorithm from BouncyCastle to
CryptoJS here:
https://github.com/mitchellrj/KeePassJS/blob/master/bouncycastle/twofish.js
It is under the MIT license, so if this fits with your current New BSD license,
please feel free to include it in your next release.
Original issue reported on code.google.com by [email protected]
on 18 Sep 2012 at 9:22
What steps will reproduce the problem?
Use the latest Chrome dev (6.0.495.0)
Call:
Crypto.util.bytesToBase64(Crypto.HMAC(Crypto.SHA1, "GA", "GA", {asBytes: true}))
What is the expected output? What do you see instead?
Expected: bBg1Ebw0ajGh8E47JCjrZ63PdKI=
Instead I see: o4iKvmV1Ahll2gbgpSLys/9e5pY=
What version of the product are you using? On what operating system?
Chrome (6.0.495.0) on OSX
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 19 Aug 2010 at 1:44
I have an application where I want to incrementally compute hashes of data, eg.
SHA256(A)
SHA256(A+B)
SHA256(A+B+C)
etc.
I don't want this to be an O(n^2) algorithm, so I was wondering if the API
could support a lower-level object with an API like:
var sha256 = new Crypto.SHA256()
sha256.append(A)
var digestA = sha256.digest();
sha256.append(B)
var digestB = sha256.digest();
// etc.
It seems like the algorithm allows this and that this would be easy to
implement. What do you think?
Original issue reported on code.google.com by [email protected]
on 26 Jan 2012 at 6:10
What steps will reproduce the problem?
1. Replace YUI Compressor with Google Closure compiler
2. See build fail
The following cause errors and/or warnings:
in CBC.js:
while (c.pop() != 0x80) ;
The compiler wants {} instead of ;
in AES.js (twice):
mode = options && options.mode || C.mode.OFB;
The variable mode is not declared. Prepending "var " to the lines solves this.
Original issue reported on code.google.com by [email protected]
on 5 Mar 2011 at 1:07
What steps will reproduce the problem?
1. The hashed on Blackberry mobile is different than on Chrome (and FF for what
I know)
2. You can test it there if you have a Blackberry around:
http://jsfiddle.net/CetxX/1/
What is the expected output? What do you see instead?
for example if I hash example I get 856bb01aa1711861595f792270325476ebd3ba4a
where I expect c3499c2729730a7f807efb8676a92dcb6f8a3f8f
What version of the product are you using? On what operating system?
tried on version 3.0 (see the jsfiddle) and v2.5.3
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 8 May 2012 at 5:45
The unpad operation should verify that the padding bytes are as expected and
throw an Error if they are not, rather than assuming the bytes are correct.
Use of the wrong cipher key or specification will cause invalid padding so this
is a common mode of failure and we should check for this to alert developers to
the real problem.
Original issue reported on code.google.com by [email protected]
on 7 Apr 2012 at 2:50
It would be nice if it were possible to interface to CryptoJS using Javascript
Typed Arrays.
A fairly low effort solution would be to allow WordArray to accept an
ArrayBuffer as input and provide a conversion to ArrayBuffer as output. Would
there be support for this addition if a patch were supplied to implement it?
Original issue reported on code.google.com by [email protected]
on 22 Aug 2012 at 9:18
Currently it seems that symmetric ciphers like AES can work with CBC mode but
only using random iv.
Could you add ability to provide iv along with mode in options to AES?
Original issue reported on code.google.com by [email protected]
on 5 Jul 2010 at 11:59
What steps will reproduce the problem?
1. Start the Testsuite on Opera 10.53
What is the expected output? What do you see instead?
All tests should pass but these are failing
test util.gt: failed.
Value should be true.
Expected: true (boolean)
Actual: false (boolean)
test util.lt: failed.
Value should be true.
Expected: true (boolean)
Actual: false (boolean)
test util.endian: failed.
Values should be equal.
Expected: 4041261184 (number)
Actual: -253706112 (number)
test enc.UTF8.decode: failed.
Values should be equal.
Expected: 1105365410,3465620992 (string)
Actual: 1105365410,-829346304 (string)
test enc.Base64.decode: failed.
Values should be equal.
Expected: 352033795,3648913408 (string)
Actual: 352033795,-646053888 (object)
test types.WordArray.concat: failed.
Values should be equal.
Expected: 4294967295 (string)
Actual: -1 (string)
test SHA256: failed.
Values should be equal.
Expected: f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650
(string)
Actual: 8a19c396a89853b8baf0050e3b4dfeb4f19bae586f6b491249a1fe38ff98faa5
(string)
Opera
Version 10.53
Build 3374
Platform Win32
Original issue reported on code.google.com by [email protected]
on 5 Jun 2010 at 2:07
If you encrypt data with the following openssl command line:
openssl enc -aes-256-cbc -e -in foo.txt -out foo.txt.enc -pass pass:"Secret Passphrase" -base64
And attempt to decrypt the contents of foo.txt.enc with:
CryptoJS.AES.decrypt(buffer, "Secret Passphrase");
The result is empty. The reason appears to be because of the newline character
in the base64-encoded output (of openssl). If you remove the newline, such
that the entire base64 encoding is on a single line, then CryptoJS.AES.decrypt
works fine.
The documentation suggests that CryptoJS.AES is compatible with openssl. I'm
using version 1.0.1 14 Mar 2012 of openssl.
What steps will reproduce the problem?
1. Encrypt a message with the above openssl command line that is long enough to
cause openssl to break the base64-encoding into two (or more?) lines. I used
the message "This is a test of the emergency broadcast system.\n".
2. Use CryptoJS.AES.decrypt(message, "Secret Passphrase") to compute the
plaintext.
3. Note that the resulting value is empty and not the original text.
4. Remove the newlines from the base64-encoded output of openssl.
5. Repeat step 2.
6. Note that the plaintext is as expected.
I'm using CryptoJS v3.0.1. Browser is Firefox 12. Operating system is Mac OS X
10.7.4.
Original issue reported on code.google.com by [email protected]
on 21 May 2012 at 9:10
What steps will reproduce the problem?
1. Do this: Crypto.SHA256('\xff')
What is the expected output? What do you see instead?
The hash should be (tested in Python):
a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89
But is:
ea47fa96cf6d727d3068913da9193fef44aec4ee2c5972e9ac50cf7d637a56cf
What version of the product are you using? On what operating system?
I am using Crypto-js version 2.5.2. I tried the fix in issue #16, but it
doesn't work (same output).
Please provide any additional information below.
The other hash is one using Python: hashlib.sha256('\xff').hexdigest()
Original issue reported on code.google.com by [email protected]
on 7 Jan 2012 at 8:57
What steps will reproduce the problem?
1.
/*** encrypt */
var ciphertext = Crypto.AES.encrypt(plaintext , "Secret Passphrase",
{ mode: new Crypto.mode.OFB(Crypto.pad.ZeroPadding) });
2.
/*** decrypt */
var plain = Crypto.AES.decrypt(ciphertext, "Secret Passphrase",
{ mode: new Crypto.mode.OFB(Crypto.pad.ZeroPadding) });
What is the expected output?
// encrypt
ciphertext = "SwcOSeXEGMIQUKEn7ibuoV28KfNXBPH3tngp3ORySr0=";
// decrypt
plaintext = "plaintext"; // this is 9 bytes
What do you see instead?
plaintext = "plaintext???????"; // this is 16 bytes
What version of the product are you using?
*crypto-js v2.4.0
*crypto-js v2.5.2
*crypto-js v2.5.3
On what operating system?
SO: Windows 7 - 32 bit
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101
Firefox/10.0.2
Please provide any additional information below.
The ZeroPadding should be fixed now in release 2.5.4 and in the latest 3.x
release.
Original issue reported on code.google.com by [email protected]
on 30 May 2012 at 8:22
Since some time, WebKit implements a function called
window.crypto.getRandomValues() that generates cryptographically secure random
values using the operating system's entropy pool. This feature is just now in
the process of being integrated into Gecko, too:
https://bugzilla.mozilla.org/show_bug.cgi?id=440046
The attached patch checks if getRandomValues() and, if available, uses it,
while falling back to Math.random() otherwise. I tested it on both Chromium
(which has getRandomValues) and Firefox (which currently doesn't) and it seems
to work fine, with the right code path being used.
Original issue reported on code.google.com by [email protected]
on 10 Jan 2012 at 5:37
Attachments:
I needed compatibility with node.js crypto, so I had to hack AES.js to pass IV
in. At the same time, IV had to be packaged separately and not part of the
encrypted result.
My modified version of AES.js is attached for your review.
Note that options.iv is assumed to be an array in my version.
Thx.
Original issue reported on code.google.com by [email protected]
on 14 Mar 2011 at 9:24
Attachments:
The CryptoJS files should include a license header, or there should be a
LICENSE file in the source tree. Right now, one can find the license only by
visiting the google code page, which might be problematic from a legal
standpoint.
Original issue reported on code.google.com by [email protected]
on 22 Jan 2012 at 10:34
When using the HMAC SHA1 functions, the functions do not return the same
data as provided by the RFC2202 (http://www.faqs.org/rfcs/rfc2202.html).
Original issue reported on code.google.com by [email protected]
on 15 Mar 2010 at 2:09
It would be great if Crypto-JS implemented some public key cryptography such as
RSA or something in the ECC space. Although there are some JavaScript RSA
implementation floating around in the net, their quality is doubtful and if you
want to use it in conjunction with the symmetric ciphers and hash functions of
Crypto-JS (which would not be unusual, I believe) you run into problems because
of inconsistent interfaces.
Original issue reported on code.google.com by [email protected]
on 10 Jan 2012 at 1:36
We are trying to decrypt existing AES crypto that uses the CBC mode. The
problem is that the upper layers always make sure that the plain text is of
correct length, and thus no padding mechanism is needed from the encryption
library. crypto-js however, assumes in CBC mode that the data has been padded
in a specific way.
We are trying to write a library that is compatible with a piece of existing
software, so we cannot change that software to add a crypto-js compatible
padding. Also the other way around, while encrypting the data, the padding
added by crypto-js CBC code might break the original application while it tries
to decrypt items created by crypto-js.
We were able to work around this by making our own copy of the cbc mode and
commenting out the padding related code. However we are hoping the library
would gain an option for disabling the padding.
Original issue reported on code.google.com by [email protected]
on 18 Jun 2010 at 9:06
This is a request, not an issue. Is there a chance that we could have the
Blake-256 and Blake-512 hashing algoritms added to this library? Thank you.
Original issue reported on code.google.com by [email protected]
on 29 Nov 2011 at 4:51
What steps will reproduce the problem?
1. Read a file of 536.870.912 bytes or bigger with
FileReaderSync.readAsArrayBuffer() in chunks of 1MB;
2. For each chunk, run the "CryptoJS.algo.SHA256.update" method (the entire
code is attached).
3. The hash is wrong.
What is the expected output? What do you see instead?
Expected: 3a6e761d5033b09bd41528b23501c906ebdf8a30bcd4ee35bb4d22d5beae0fb8
Result: 8514390ffc132aa5cc1d1234d629faae4675016f7ed632bc6755fc987432708c
What version of the product are you using? On what operating system?
3.0.2 - Windows 7 (Firefox 10 and Chrome 21)
Please provide any additional information below.
The hash for files of size until 536.870.911 bytes are right.
It's probably a problem of converting a C code to JS. In C, the "int" has 32
bits so it overflows on 4.294.967.296 bits (536.870.912 * 8). JS doesn't have
this problem.
We could to fix this problem in this lib [1]. In the "sha256_final" function,
he uses the count array to control the overflow (count[0] for the first bits
and count[1] for the overflow). We forced the overflow with the 536.870.912
bytes file by setting "count[0] = 0" and "count[1] = 1" and it worked.
We tried to do the same thing with crypto-js (which is a faster lib) but we
couldn't understand the code (it's not your fault - it's ours).
[1] http://www.bichlmeier.info/sha256.js
Original issue reported on code.google.com by [email protected]
on 4 Sep 2012 at 10:40
Attachments:
What steps will reproduce the problem?
1. Download file
http://download.aptana.com/studio3/standalone/3.0.6/win/Aptana_Studio_3_Setup_3.
0.6.exe
2. Calculate SHA256 checksum in Firefox
What is the expected output? What do you see instead?
expected:
33511286209c73e490d558cbfdfbba2caac93632fe58217d3d343aa5fb0ee8b4
result:
d1cdbe54d3319330bb1a921042c696dad794e19009c05d08b7b55518f90b4ed8
What version of the product are you using? On what operating system?
Firefox 8 (Windows 7 x64)
How to fix:
SHA256 function:
change line:
a = t1 + t2;
to:
a = (t1 + t2) >>>0;
Original issue reported on code.google.com by [email protected]
on 9 Nov 2011 at 6:28
What steps will reproduce the problem?
1. cd builder/
2. php -f builder.php
3. Lots of warnings about missing files.
What version of the product are you using? On what operating system?
Using checkout from subversion.
Please provide any additional information below.
The files and rollups arrays in builder/builder.php are all in lower case and
used for referencing files in the project even though the actual files are
using mixed casing.
The supplied patch should fixed the issue for my part.
Original issue reported on code.google.com by [email protected]
on 13 Feb 2012 at 6:53
Attachments:
Problem: Browsers will stop and display a warning when crypto operations takes
too long to run (like PBKDF2 with large iteration). Means of detection browsers
use varies, some measure actual time, others measuring # of statements.
Suggested solution: divide up crypto operations into smaller units and run each
unit through a callback argument. With browsers, callback can be implemented
using setTimeout or Web worker API. With Node.js, callback can call
process.nextTick.
Original issue reported on code.google.com by [email protected]
on 7 Mar 2011 at 12:34
This is not a issue, is a request, is there any posibility to integrate SHA-512
hash to this lib?
Thanks!
Original issue reported on code.google.com by [email protected]
on 12 Apr 2012 at 3:26
Let's say long_string is a 1 MB string. I am getting the following error:
CryptoJS.AES.encrypt(long_string, "Secret Passphrase");
RangeError: Maximum call stack size exceeded
Encryption works properly up to about 400 KB strings.
Original issue reported on code.google.com by [email protected]
on 15 May 2012 at 5:10
What steps will reproduce the problem?
1. run Crypto.SHA256("á") in firebug
What is the expected output?
fb9778719d93551b1c88df5f1ab229f83ea30af112fc51017c9f0a383dcf6cb3
What do you see instead?
eb3e85d7fbf56104c8021681e68d771b9b9205b93e9219c8f81f60af703de381
What version of the product are you using?
2.0.0
On what operating system?
Mac/Chrome 7
Original issue reported on code.google.com by [email protected]
on 17 Nov 2010 at 3:25
1. DES does not work with mode: ECB, CBC or CTR.
2. DES does not work correctly with mode: OFB.
What steps will reproduce the problem?
1.
var crypted = Crypto.DES.encrypt("Message", "Secret Passphrase", { mode: new
Crypto.mode.CBC }); - not working.
FireBug console: "a._encryptblock is not a function"
2.
var crypted = Crypto.DES.encrypt("Message", "Secret Passphrase");
crypted = Crypto.util.base64ToBytes(crypted);
crypted = Crypto.charenc.Binary.bytesToString(crypted);
// crypted = plaintext = "Message"
crypted = crypted.substring(8);
- the same result with PHP function base64decode
What version of the product are you using? On what operating system?
Chrome, FF+FireBug and 2.5.1
Please provide any additional information below.
btw a better documentation would be nice
Original issue reported on code.google.com by [email protected]
on 2 Nov 2011 at 8:53
What steps will reproduce the problem?
1.Run Crypto.util.bytesToWords([0,0,-1,0])
What is the expected output? What do you see instead?
Expected output: 0x0000FF00 (65280).
The produced output: 0xFFFFFF00 (-256).
What version of the product are you using? On what operating system?
2.5.2
Please provide any additional information below.
To fix this problem, the following line inside Crypto.util.bytesToWords
words[b>>5] |= bytes[i] << (24-b%32)
can be replaced with
words[b>>5] |= (bytes[i] & 0xFF) << (24-b%32)
Original issue reported on code.google.com by [email protected]
on 22 Nov 2011 at 9:54
Implement SHA-512.
Existing implementations under BSD license are at:
http://jssha.sourceforge.net/
http://pajhome.org.uk/crypt/md5/sha512.html
Original issue reported on code.google.com by [email protected]
on 9 Mar 2012 at 8:50
While using crypto-js we have experienced some problems in converting a byte
string into a list of integers. We occasionally get values bigger than 0xff.
Which obviously should not happen when converting a bytestring into integers.
We were able to fix the problem by doing a bitwise AND against 0xff before
outputting the value (see code below). This seemed to fix the issue for us. We
feel this might be a bug in the library. In case we got it wrong, we'd like to
gain better understanding about what is happening.
Crypto.charenc.Binary.stringToBytes = function (str) {
for (var bytes = [], i = 0; i < str.length; i++) {
bytes.push(str.charCodeAt(i) & 0xff);
}
return bytes;
};
Original issue reported on code.google.com by [email protected]
on 18 Jun 2010 at 8:57
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.