welsonjs/lib/crypto-js/mode-ctr-gladman.min.js
2023-07-27 18:09:20 +09:00

1 line
764 B
JavaScript

!function(e,r){"object"==typeof exports?module.exports=exports=r(require("./core"),require("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],r):r(e.CryptoJS)}(this,function(e){function d(e){if(255==(e>>24&255)){var r=e>>16&255,o=e>>8&255,i=255&e;255===r?(r=0,255===o?(o=0,255===i?i=0:++i):++o):++r,e=0,e+=r<<16,e+=o<<8,e+=i}else e+=1<<24;return e}var r,o;return e.mode.CTRGladman=(r=e.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(e,r){var o,i=this._cipher,t=i.blockSize,c=this._iv,n=this._counter;c&&(n=this._counter=c.slice(0),this._iv=void 0),0===((o=n)[0]=d(o[0]))&&(o[1]=d(o[1]));var p=n.slice(0);i.encryptBlock(p,0);for(var s=0;s<t;s++)e[r+s]^=p[s]}}),r.Decryptor=o,r),e.mode.CTRGladman});