Comments (7)
It's interesting idea. The upcoming 3.0 release will indeed support
incrementally appending the message. Though, it'll be tricky to continue
appending after you've completed the digest. Completing the digest involves
adding padding, then hashing the last padded block.
Original comment by Jeff.Mott.OR
on 26 Jan 2012 at 7:23
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from crypto-js.
Cool. It seems doable if you just make the final padding and hashing
calculation local to the function that returns the digest instead of mutating
the object (you could cache the digest if you were worried about the efficiency
of repeated calls to digest()).
Is the code for your upcoming 3.0 release currently available in a public
repository? If so I'd be happy to take a stab at it and send a patch, if you
like.
Original comment by [email protected]
on 26 Jan 2012 at 8:00
- Added labels: ****
- Removed labels: ****
from crypto-js.
http://code.google.com/p/crypto-js/source/browse/branches/#branches%2F3.x%2Fsrc
Original comment by Jeff.Mott.OR
on 26 Jan 2012 at 8:08
- Added labels: ****
- Removed labels: ****
from crypto-js.
I also have the need to compute MD5 checksums incrementally. This, combined
with the new HTML5 File APIs would allow for a very robust upload mechanism.
Any estimate on when this functionality (supposedly in version 3) will be
available?
Thanks!
Evan
Original comment by [email protected]
on 16 Mar 2012 at 9:23
- Added labels: ****
- Removed labels: ****
from crypto-js.
Version 3 is very close. I'd expect it to be ready within the next month. I'm
mostly focusing on the cipher components now, and the hashing components are
largely set.
Here's a preview for you.
<!doctype html>
<script
src="http://crypto-js.googlecode.com/svn-history/r437/branches/3.x/src/core.js">
</script>
<script
src="http://crypto-js.googlecode.com/svn-history/r437/branches/3.x/src/sha256.js
"></script>
<script
src="http://crypto-js.googlecode.com/svn-history/r437/branches/3.x/src/enc-base6
4.js"></script>
<script>
// Basic hashing
var hash = CryptoJS.SHA256('abc');
// Output encoding
alert('Hash encoded as latin-1 string: ' + hash.toString(CryptoJS.enc.Latin1));
alert('Hash encoded as base-64 string: ' + hash.toString(CryptoJS.enc.Base64));
alert('Hash encoded as hex string: ' + hash); // Default is hex
// Incremental hashing
var sha256 = CryptoJS.algo.SHA256.create();
sha256.update('a');
sha256.update('b');
sha256.update('c');
var hash = sha256.finalize();
alert('Incrementally computed hash: ' + hash);
// Incremental hashing, capturing intermediate hash values
var sha256 = CryptoJS.algo.SHA256.create();
var hashA = sha256.update('a').clone().finalize();
var hashAB = sha256.update('b').clone().finalize();
var hashABC = sha256.update('c').clone().finalize();
alert('Intermediate hash value "a": ' + hashA);
alert('Intermediate hash value "ab": ' + hashAB);
alert('Intermediate hash value "abc": ' + hashABC);
</script>
Original comment by Jeff.Mott.OR
on 16 Mar 2012 at 10:27
- Added labels: ****
- Removed labels: ****
from crypto-js.
This feature now officially available with version 3.
Original comment by Jeff.Mott.OR
on 6 May 2012 at 7:51
- Changed state: Fixed
- Added labels: ****
- Removed labels: ****
from crypto-js.
Great! Thanks for the excellent work, Jeff.
Original comment by [email protected]
on 7 May 2012 at 7:50
- Added labels: ****
- Removed labels: ****
from crypto-js.
Related Issues (20)
- Request: Support RSA signing and validation HOT 2
- Code misses license headers or LICENSE file HOT 1
- Builder assumes case insensitive file system HOT 1
- PBKDF2Async updates too much and is very slow. HOT 1
- SHA 512 implementation HOT 5
- Error encrypt / decrypt CTR (AES) HOT 5
- Not obvious how many bits AES encryption uses. HOT 2
- Add support for Whirlpool digest HOT 1
- Crypto-JS v2.5.3 is reacting differently on Embed devices (Samsung Smart TV (sdk 2.XX)) and Desktop/Web HOT 5
- Unpad should throw Error if input in Invalid HOT 1
- SHA-512 HOT 1
- SHA1 hashed are different on Blackberry HOT 2
- Core concat error HOT 2
- PBKDF2 does not produce the expected results HOT 2
- AES encryption fails for long strings HOT 2
- crypto-js is not compatible with openssl base64 encoding when decrypting with AES/CBC HOT 7
- padding schemes corrupted - ZeroPadding HOT 1
- Add support for Javascript Typed Arrays HOT 5
- Cannot read property 'words' of undefined HOT 2
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 crypto-js.