UNPKG

918 BJavaScriptView Raw
1;(function (root, factory, undef) {
2 if (typeof exports === "object") {
3 // CommonJS
4 module.exports = exports = factory(require("./core"), require("./cipher-core"));
5 }
6 else if (typeof define === "function" && define.amd) {
7 // AMD
8 define(["./core", "./cipher-core"], factory);
9 }
10 else {
11 // Global (browser)
12 factory(root.CryptoJS);
13 }
14}(this, function (CryptoJS) {
15
16 /**
17 * ISO/IEC 9797-1 Padding Method 2.
18 */
19 CryptoJS.pad.Iso97971 = {
20 pad: function (data, blockSize) {
21 // Add 0x80 byte
22 data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
23
24 // Zero pad the rest
25 CryptoJS.pad.ZeroPadding.pad(data, blockSize);
26 },
27
28 unpad: function (data) {
29 // Remove zero padding
30 CryptoJS.pad.ZeroPadding.unpad(data);
31
32 // Remove one more byte -- the 0x80 byte
33 data.sigBytes--;
34 }
35 };
36
37
38 return CryptoJS.pad.Iso97971;
39
40}));
\No newline at end of file