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

  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. * ISO/IEC 9797-1 Padding Method 2.
  17. */
  18. CryptoJS.pad.Iso97971 = {
  19. pad: function (data, blockSize) {
  20. // Add 0x80 byte
  21. data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
  22. // Zero pad the rest
  23. CryptoJS.pad.ZeroPadding.pad(data, blockSize);
  24. },
  25. unpad: function (data) {
  26. // Remove zero padding
  27. CryptoJS.pad.ZeroPadding.unpad(data);
  28. // Remove one more byte -- the 0x80 byte
  29. data.sigBytes--;
  30. }
  31. };
  32. return CryptoJS.pad.Iso97971;
  33. }));