forked from brix/crypto-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
des-profile.js
31 lines (26 loc) · 1.02 KB
/
des-profile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
YUI.add('algo-des-profile', function (Y) {
var C = CryptoJS;
Y.Profiler.add({
name: 'DES',
setUp: function () {
this.data = {
key: C.enc.Hex.parse('0001020304050607'),
iv: C.enc.Hex.parse('08090a0b0c0d0e0f')
};
},
profileSinglePartMessage: function () {
var singlePartMessage = '';
for (var i = 0; i < 100; i++) {
singlePartMessage += '12345678901234567890123456789012345678901234567890';
}
C.algo.DES.createEncryptor(this.data.key, { iv: this.data.iv }).finalize(singlePartMessage) + '';
},
profileMultiPartMessage: function () {
var des = C.algo.DES.createEncryptor(this.data.key, { iv: this.data.iv });
for (var i = 0; i < 100; i++) {
des.process('12345678901234567890123456789012345678901234567890') + '';
}
des.finalize() + '';
}
});
}, '$Rev$');