webogram-i2p/app/js/lib/aes_worker.js

27 lines
758 B
JavaScript
Raw Normal View History

2014-01-05 16:07:11 +00:00
/*!
2014-06-27 15:22:41 +00:00
* Webogram v0.1.8 - messaging web application for MTProto
2014-01-05 16:07:11 +00:00
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/
importScripts(
2014-03-26 15:36:52 +00:00
'../../vendor/console-polyfill/console-polyfill.js',
'bin_utils.js',
'../../vendor/jsbn/jsbn_combined.js',
2014-03-26 15:36:52 +00:00
'../../vendor/cryptoJS/crypto.js'
);
2014-01-05 16:07:11 +00:00
onmessage = function (e) {
// console.log('AES worker in', e.data);
var taskID = e.data.taskID,
result;
if (e.data.task == 'encrypt') {
result = aesEncrypt(e.data.bytes, e.data.keyBytes, e.data.ivBytes);
} else {
result = aesDecrypt(e.data.encryptedBytes, e.data.keyBytes, e.data.ivBytes);
}
postMessage({taskID: taskID, result: result});
2014-02-13 15:37:20 +00:00
}