forked from brix/crypto-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hmac-md5-profile.js
30 lines (25 loc) · 947 Bytes
/
hmac-md5-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
YUI.add('algo-hmac-md5-profile', function (Y) {
var C = CryptoJS;
Y.Profiler.add({
name: 'HMAC MD5',
setUp: function () {
this.data = {
key: C.lib.WordArray.random(128/8)
};
},
profileSinglePartMessage: function () {
var singlePartMessage = '';
for (var i = 0; i < 500; i++) {
singlePartMessage += '12345678901234567890123456789012345678901234567890';
}
C.algo.HMAC.create(C.algo.MD5, this.data.key).finalize(singlePartMessage) + '';
},
profileMultiPartMessage: function () {
var hmac = C.algo.HMAC.create(C.algo.MD5, this.data.key);
for (var i = 0; i < 500; i++) {
hmac.update('12345678901234567890123456789012345678901234567890');
}
hmac.finalize() + '';
}
});
}, '$Rev$');