mode-ecb.js 893 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * Electronic Codebook block mode.
  17. */
  18. CryptoJS.mode.ECB = (function () {
  19. var ECB = CryptoJS.lib.BlockCipherMode.extend();
  20. ECB.Encryptor = ECB.extend({
  21. processBlock: function (words, offset) {
  22. this._cipher.encryptBlock(words, offset);
  23. }
  24. });
  25. ECB.Decryptor = ECB.extend({
  26. processBlock: function (words, offset) {
  27. this._cipher.decryptBlock(words, offset);
  28. }
  29. });
  30. return ECB;
  31. }());
  32. return CryptoJS.mode.ECB;
  33. }));