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
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
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
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
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
from crypto-js.
Great! Thanks for the excellent work, Jeff.
Original comment by [email protected]
on 7 May 2012 at 7:50
from crypto-js.
Related Issues (20)
- AES encrypted string to be converted to base 64 string and then to byte array in Javascript
- Uncaught TypeError: Cannot read property 'init' of undefined HOT 1
- Clarify license HOT 2
- Automatic key expiration
- Type a is undefined in rollup version of aes.js line 27. HOT 4
- Crypto.JS PBKDF2 Results Differnt then .Net Rfc2898DeriveBytes HOT 1
- Crypto-js decryption implemention HOT 1
- Most of the hashs wont works regarding file encoding HOT 4
- Not able to decrypt the encrypted data on server side which was encrypted using CryproJS on client side..
- TripleDES result is different each time, and is not correct
- AES 256 decrypt from data oracle function encrypting HOT 1
- Broken hashing with sigBytes< bytes
- Error: Unable to get property 'createEncryptor' of undefined or null reference
- [IE8]Object doesn't support property or method
- decrypt of ciphertext not working for strings HOT 2
- [documentation] Add recommendation to use https
- Using pbkdf2Sync function with sha256 gives different key with different system architecture (32 bit and 64 bit) HOT 2
- After encryption CryptoJS returning script then encrypted text
- I am using CryptoJS MD5 algorith for large files, it is very very very slow, how to icrease performance
- Sha3 result different for long strings on android 4.2.2 webview
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.