forked from brix/crypto-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pad-pkcs7-test.js
28 lines (21 loc) · 959 Bytes
/
pad-pkcs7-test.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
YUI.add('pad-pkcs7-test', function (Y) {
var C = CryptoJS;
Y.Test.Runner.add(new Y.Test.Case({
name: 'Pkcs7',
testPad: function () {
var data = C.lib.WordArray.create([0xdddddd00], 3);
C.pad.Pkcs7.pad(data, 2);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd05, 0x05050505]).toString(), data.toString());
},
testPadClamp: function () {
var data = C.lib.WordArray.create([0xdddddddd, 0xdddddddd], 3);
C.pad.Pkcs7.pad(data, 2);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd05, 0x05050505]).toString(), data.toString());
},
testUnpad: function () {
var data = C.lib.WordArray.create([0xdddddd05, 0x05050505]);
C.pad.Pkcs7.unpad(data);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd00], 3).toString(), data.toString());
}
}));
}, '$Rev$');