packages/cafeteria/plugins/cordova-plugin-secure-storage/www/sjcl_ss.js
function (prf, ciphertext, iv, adata, tlen) {
    var out, data = ciphertext.slice(0), tag, w=sjcl.bitArray, l=w.bitLength(data);
    tlen = tlen || 128;
    adata = adata || [];

    // Slice tag out of data
    if (tlen <= l) {
      tag = w.bitSlice(data, l-tlen);
      data = w.bitSlice(data, 0, l-tlen);
    } else {
      tag = data;
      data = [];
    }

    // decrypt and tag
    out = sjcl.mode.gcm._ctrMode(false, prf, data, adata, iv, tlen);

    if (!w.equal(out.tag, tag)) {
      throw new sjcl.exception.corrupt("gcm: tag doesn't match");
    }
    return out.data;
  }
function (prf, ciphertext, iv, adata, tlen) {
    var out, data = ciphertext.slice(0), tag, w=sjcl.bitArray, l=w.bitLength(data);
    tlen = tlen || 128;
    adata = adata || [];

    // Slice tag out of data
    if (tlen <= l) {
      tag = w.bitSlice(data, l-tlen);
      data = w.bitSlice(data, 0, l-tlen);
    } else {
      tag = data;
      data = [];
    }

    // decrypt and tag
    out = sjcl.mode.gcm._ctrMode(false, prf, data, adata, iv, tlen);

    if (!w.equal(out.tag, tag)) {
      throw new sjcl.exception.corrupt("gcm: tag doesn't match");
    }
    return out.data;
  }
function ( prf , ciphertext , iv , adata , tlen ) { var out , data = ciphertext . slice ( 0 ) , tag , w = sjcl . bitArray , l = w . bitLength ( data ) ; tlen = tlen || 128 ; adata = adata || [ ] ; // Slice tag out of data if ( tlen <= l ) { tag = w . bitSlice ( data , l - tlen ) ; data = w . bitSlice ( data , 0 , l - tlen ) ; } else { tag = data ; data = [ ] ; } // decrypt and tag out = sjcl . mode . gcm . _ctrMode ( false , prf , data , adata , iv , tlen ) ; if ( ! w . equal ( out . tag , tag ) ) { throw new sjcl . exception . corrupt ( "gcm: tag doesn't match" ) ; } return out . data ; }
Decrypt in GCM mode.
@static
@param {Object} prf The pseudorandom function.  It must have a block size of 16 bytes.
@param {bitArray} ciphertext The ciphertext data.
@param {bitArray} iv The initialization value.
@param {bitArray} [adata=[]] The authenticated data.
@param {Number} [tlen=128] The desired tag length, in bits.
@return {bitArray} The decrypted data.
Decrypt in GCM mode .