You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
918 B
40 lines
918 B
2 years ago
|
;(function (root, factory, undef) {
|
||
|
if (typeof exports === "object") {
|
||
|
// CommonJS
|
||
|
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||
|
}
|
||
|
else if (typeof define === "function" && define.amd) {
|
||
|
// AMD
|
||
|
define(["./core", "./cipher-core"], factory);
|
||
|
}
|
||
|
else {
|
||
|
// Global (browser)
|
||
|
factory(root.CryptoJS);
|
||
|
}
|
||
|
}(this, function (CryptoJS) {
|
||
|
|
||
|
/**
|
||
|
* ISO/IEC 9797-1 Padding Method 2.
|
||
|
*/
|
||
|
CryptoJS.pad.Iso97971 = {
|
||
|
pad: function (data, blockSize) {
|
||
|
// Add 0x80 byte
|
||
|
data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
|
||
|
|
||
|
// Zero pad the rest
|
||
|
CryptoJS.pad.ZeroPadding.pad(data, blockSize);
|
||
|
},
|
||
|
|
||
|
unpad: function (data) {
|
||
|
// Remove zero padding
|
||
|
CryptoJS.pad.ZeroPadding.unpad(data);
|
||
|
|
||
|
// Remove one more byte -- the 0x80 byte
|
||
|
data.sigBytes--;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
return CryptoJS.pad.Iso97971;
|
||
|
|
||
|
}));
|