Sha256: 9e67161f61922a475b142b2e18cb4470ed7860ef61bc6e7a41f327f7a59be96f

Contents?: true

Size: 1.43 KB

Versions: 32

Compression:

Stored size: 1.43 KB

Contents

;(function (root, factory, undef) {
	if (typeof exports === "object") {
		// CommonJS
		module.exports = exports = factory(require("./core"), require("./cipher-core"));
	}
	else if (typeof define === "function" && define.amd) {
		// AMD
		define(["./core", "./cipher-core"], factory);
	}
	else {
		// Global (browser)
		factory(root.CryptoJS);
	}
}(this, function (CryptoJS) {

	/**
	 * Counter block mode.
	 */
	CryptoJS.mode.CTR = (function () {
	    var CTR = CryptoJS.lib.BlockCipherMode.extend();

	    var Encryptor = CTR.Encryptor = CTR.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher
	            var blockSize = cipher.blockSize;
	            var iv = this._iv;
	            var counter = this._counter;

	            // Generate keystream
	            if (iv) {
	                counter = this._counter = iv.slice(0);

	                // Remove IV for subsequent blocks
	                this._iv = undefined;
	            }
	            var keystream = counter.slice(0);
	            cipher.encryptBlock(keystream, 0);

	            // Increment counter
	            counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0

	            // Encrypt
	            for (var i = 0; i < blockSize; i++) {
	                words[offset + i] ^= keystream[i];
	            }
	        }
	    });

	    CTR.Decryptor = Encryptor;

	    return CTR;
	}());


	return CryptoJS.mode.CTR;

}));

Version data entries

32 entries across 32 versions & 3 rubygems

Version Path
appmap-0.72.2 ./node_modules/crypto-js/mode-ctr.js
appmap-0.72.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.72.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.71.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.70.2 ./node_modules/crypto-js/mode-ctr.js
appmap-0.70.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.70.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.69.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.68.2 ./node_modules/crypto-js/mode-ctr.js
appmap-0.68.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.68.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.67.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.67.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.66.2 ./node_modules/crypto-js/mode-ctr.js
appmap-0.66.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.66.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.65.1 ./node_modules/crypto-js/mode-ctr.js
appmap-0.65.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.64.0 ./node_modules/crypto-js/mode-ctr.js
appmap-0.63.0 ./node_modules/crypto-js/mode-ctr.js