mode-ecb.js 993 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ;(function (root, factory, undef) {
  2. if (typeof exports === "object") {
  3. // CommonJS
  4. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  5. } else if (typeof define === "function" && define.amd) {
  6. // AMD
  7. define(["./core", "./cipher-core"], factory);
  8. } else {
  9. // Global (browser)
  10. factory(root.CryptoJS);
  11. }
  12. }(this, function (CryptoJS) {
  13. /**
  14. * Electronic Codebook block mode.
  15. */
  16. CryptoJS.mode.ECB = (function () {
  17. var ECB = CryptoJS.lib.BlockCipherMode.extend();
  18. ECB.Encryptor = ECB.extend({
  19. processBlock: function (words, offset) {
  20. this._cipher.encryptBlock(words, offset);
  21. }
  22. });
  23. ECB.Decryptor = ECB.extend({
  24. processBlock: function (words, offset) {
  25. this._cipher.decryptBlock(words, offset);
  26. }
  27. });
  28. return ECB;
  29. }());
  30. return CryptoJS.mode.ECB;
  31. }));