1 | ;(function (root, factory, undef) {
|
2 | if (typeof exports === "object") {
|
3 |
|
4 | module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
5 | }
|
6 | else if (typeof define === "function" && define.amd) {
|
7 |
|
8 | define(["./core", "./cipher-core"], factory);
|
9 | }
|
10 | else {
|
11 |
|
12 | factory(root.CryptoJS);
|
13 | }
|
14 | }(this, function (CryptoJS) {
|
15 |
|
16 | |
17 |
|
18 |
|
19 | CryptoJS.pad.AnsiX923 = {
|
20 | pad: function (data, blockSize) {
|
21 |
|
22 | var dataSigBytes = data.sigBytes;
|
23 | var blockSizeBytes = blockSize * 4;
|
24 |
|
25 |
|
26 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
|
27 |
|
28 |
|
29 | var lastBytePos = dataSigBytes + nPaddingBytes - 1;
|
30 |
|
31 |
|
32 | data.clamp();
|
33 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
|
34 | data.sigBytes += nPaddingBytes;
|
35 | },
|
36 |
|
37 | unpad: function (data) {
|
38 |
|
39 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
40 |
|
41 |
|
42 | data.sigBytes -= nPaddingBytes;
|
43 | }
|
44 | };
|
45 |
|
46 |
|
47 | return CryptoJS.pad.Ansix923;
|
48 |
|
49 | })); |
\ | No newline at end of file |