src/crypto/aes-browser.js
function AESKey(key, bits) {
  if (!(this instanceof AESKey))
    return new AESKey(key, bits);

  this.rounds = null;
  this.userKey = key;
  this.bits = bits;

  switch (this.bits) {
    case 128:
      this.rounds = 10;
      break;
    case 192:
      this.rounds = 12;
      break;
    case 256:
      this.rounds = 14;
      break;
    default:
      throw new Error('Bad key size.');
  }

  assert(Buffer.isBuffer(key));
  assert(key.length === this.bits / 8);

  this.decryptKey = null;
  this.encryptKey = null;
}
function AESKey(key, bits) {
  if (!(this instanceof AESKey))
    return new AESKey(key, bits);

  this.rounds = null;
  this.userKey = key;
  this.bits = bits;

  switch (this.bits) {
    case 128:
      this.rounds = 10;
      break;
    case 192:
      this.rounds = 12;
      break;
    case 256:
      this.rounds = 14;
      break;
    default:
      throw new Error('Bad key size.');
  }

  assert(Buffer.isBuffer(key));
  assert(key.length === this.bits / 8);

  this.decryptKey = null;
  this.encryptKey = null;
}
function AESKey ( key , bits ) { if ( ! ( this instanceof AESKey ) ) return new AESKey ( key , bits ) ; this . rounds = null ; this . userKey = key ; this . bits = bits ; switch ( this . bits ) { case 128 : this . rounds = 10 ; break ; case 192 : this . rounds = 12 ; break ; case 256 : this . rounds = 14 ; break ; default : throw new Error ( 'Bad key size.' ) ; } assert ( Buffer . isBuffer ( key ) ) ; assert ( key . length === this . bits / 8 ) ; this . decryptKey = null ; this . encryptKey = null ; }
An AES key object for encrypting
and decrypting blocks.
@constructor
@ignore
@param {Buffer} key
@param {Number} bits
An AES key object for encrypting and decrypting blocks .