AI销管
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.

преди 2 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * Zero padding strategy.
  17. */
  18. CryptoJS.pad.ZeroPadding = {
  19. pad: function (data, blockSize) {
  20. // Shortcut
  21. var blockSizeBytes = blockSize * 4;
  22. // Pad
  23. data.clamp();
  24. data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
  25. },
  26. unpad: function (data) {
  27. // Shortcut
  28. var dataWords = data.words;
  29. // Unpad
  30. var i = data.sigBytes - 1;
  31. for (var i = data.sigBytes - 1; i >= 0; i--) {
  32. if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
  33. data.sigBytes = i + 1;
  34. break;
  35. }
  36. }
  37. }
  38. };
  39. return CryptoJS.pad.ZeroPadding;
  40. }));