www/js/asmcrypto/asmcrypto.all.js
/**
       * Perform ciphering operation on the supplied data.
       * @instance
       * @memberof AES_asm
       * @param {number} mode - block cipher mode (see {@link AES_asm} mode constants)
       * @param {number} pos - offset of the data being processed
       * @param {number} len - length of the data being processed
       * @return {number} Actual amount of data have been processed.
       */
Perform ciphering operation on the supplied data.
Perform ciphering operation on the supplied data .
function cipher(mode, pos, len) {
        mode = mode | 0;
        pos = pos | 0;
        len = len | 0;
        var ret = 0;
        if (pos & 15) return -1;
        while ((len | 0) >= 16) {
          _cipher_modes[mode & 7](
            DATA[pos | 0] << 24 | DATA[pos | 1] << 16 | DATA[pos | 2] << 8 | DATA[pos | 3],
            DATA[pos | 4] << 24 | DATA[pos | 5] << 16 | DATA[pos | 6] << 8 | DATA[pos | 7],
            DATA[pos | 8] << 24 | DATA[pos | 9] << 16 | DATA[pos | 10] << 8 | DATA[pos | 11],
            DATA[pos | 12] << 24 | DATA[pos | 13] << 16 | DATA[pos | 14] << 8 | DATA[pos | 15]
          );
          DATA[pos | 0] = S0 >>> 24,
            DATA[pos | 1] = S0 >>> 16 & 255,
            DATA[pos | 2] = S0 >>> 8 & 255,
            DATA[pos | 3] = S0 & 255,
            DATA[pos | 4] = S1 >>> 24,
            DATA[pos | 5] = S1 >>> 16 & 255,
            DATA[pos | 6] = S1 >>> 8 & 255,
            DATA[pos | 7] = S1 & 255,
            DATA[pos | 8] = S2 >>> 24,
            DATA[pos | 9] = S2 >>> 16 & 255,
            DATA[pos | 10] = S2 >>> 8 & 255,
            DATA[pos | 11] = S2 & 255,
            DATA[pos | 12] = S3 >>> 24,
            DATA[pos | 13] = S3 >>> 16 & 255,
            DATA[pos | 14] = S3 >>> 8 & 255,
            DATA[pos | 15] = S3 & 255;
          ret = (ret + 16) | 0,
            pos = (pos + 16) | 0,
            len = (len - 16) | 0;
        }
        return ret | 0;
      }
function cipher ( mode , pos , len ) { mode = mode | 0 ; pos = pos | 0 ; len = len | 0 ; var ret = 0 ; if ( pos & 15 ) return - 1 ; while ( ( len | 0 ) >= 16 ) { _cipher_modes [ mode & 7 ] ( DATA [ pos | 0 ] << 24 | DATA [ pos | 1 ] << 16 | DATA [ pos | 2 ] << 8 | DATA [ pos | 3 ] , DATA [ pos | 4 ] << 24 | DATA [ pos | 5 ] << 16 | DATA [ pos | 6 ] << 8 | DATA [ pos | 7 ] , DATA [ pos | 8 ] << 24 | DATA [ pos | 9 ] << 16 | DATA [ pos | 10 ] << 8 | DATA [ pos | 11 ] , DATA [ pos | 12 ] << 24 | DATA [ pos | 13 ] << 16 | DATA [ pos | 14 ] << 8 | DATA [ pos | 15 ] ) ; DATA [ pos | 0 ] = S0 >>> 24 , DATA [ pos | 1 ] = S0 >>> 16 & 255 , DATA [ pos | 2 ] = S0 >>> 8 & 255 , DATA [ pos | 3 ] = S0 & 255 , DATA [ pos | 4 ] = S1 >>> 24 , DATA [ pos | 5 ] = S1 >>> 16 & 255 , DATA [ pos | 6 ] = S1 >>> 8 & 255 , DATA [ pos | 7 ] = S1 & 255 , DATA [ pos | 8 ] = S2 >>> 24 , DATA [ pos | 9 ] = S2 >>> 16 & 255 , DATA [ pos | 10 ] = S2 >>> 8 & 255 , DATA [ pos | 11 ] = S2 & 255 , DATA [ pos | 12 ] = S3 >>> 24 , DATA [ pos | 13 ] = S3 >>> 16 & 255 , DATA [ pos | 14 ] = S3 >>> 8 & 255 , DATA [ pos | 15 ] = S3 & 255 ; ret = ( ret + 16 ) | 0 , pos = ( pos + 16 ) | 0 , len = ( len - 16 ) | 0 ; } return ret | 0 ; }
Perform ciphering operation on the supplied data.
Perform ciphering operation on the supplied data .