When encrypting/decrypting large buffers, there is no progress report. This results in a poor user experience, so I have added a progress callback for the decryption method I am using. Is there any chance of getting something similar incorporated into asmcrypto? I have tried to keep it efficient, and it makes very little difference to the overall encryption/decryption time,
In Decrypt_process I added:
:
var progress_step = data.length / 100;
var progress_mark = data.length - progress_step;
:
before "while ( dlen > tlen ) "
:
and then in the loop at the end (inside the loop) I added:
:
if (onprogress && (dlen <= progress_mark)) {
onprogress((data.length - dlen) / data.length);
progress_mark -= progress_step;
}
I also added the additional arguments to that the 'onprogress' callback can be passes into decrypt like this (the encryption is done inside a web worker to avoid blocking the main thread):
var plaintext = asmCrypto.AES_GCM.decrypt(
ciphertext, aes_key, aes_iv, '', 16, function onprogress(p) {
self.postMessage({msg:'onprogress', val:p});
}
).buffer;
When encrypting/decrypting large buffers, there is no progress report. This results in a poor user experience, so I have added a progress callback for the decryption method I am using. Is there any chance of getting something similar incorporated into asmcrypto? I have tried to keep it efficient, and it makes very little difference to the overall encryption/decryption time,
In Decrypt_process I added: : var progress_step = data.length / 100; var progress_mark = data.length - progress_step; : before "while ( dlen > tlen ) " : and then in the loop at the end (inside the loop) I added: : if (onprogress && (dlen <= progress_mark)) { onprogress((data.length - dlen) / data.length); progress_mark -= progress_step; }
I also added the additional arguments to that the 'onprogress' callback can be passes into decrypt like this (the encryption is done inside a web worker to avoid blocking the main thread):
var plaintext = asmCrypto.AES_GCM.decrypt( ciphertext, aes_key, aes_iv, '', 16, function onprogress(p) { self.postMessage({msg:'onprogress', val:p}); } ).buffer;
Is something like this possible?