/*(c) 2006 - 2008 AllenPort Co. All Rights Reserved.
All versions of this code, including the source and executable versions, 
constitute the intellectual property of AllenPort Co., which expressly reserves 
any and all U.S. and foreign rights and benefits to the code under copyright, 
trade secret and any other intellectual property law or international treaty 
whatsoever. Use of the code is subject to the terms and conditions of a separate 
written license agreement, and the code shall not be reproduced, modified, distributed 
or otherwise used in any form or manner whatsoever without obtaining the prior written 
permission of AllenPort Co. Any unauthorized reproduction or distribution of the code, 
or any portion of it, may result in civil and criminal penalties and be prosecuted 
to the fullest extent of the law.*/
// message and key are just strings
// function returns encrypted string
function sym_encrypt(message, key)
{
  var ivec = new Array(
    0x12, 0x34, 0x56, 0x78, 
    0x12, 0x34, 0x56, 0x78,
    0x12, 0x34, 0x56, 0x78,
    0x12, 0x34, 0x56, 0x78
  );

  return aesCfb(message, key, ivec, 1);
}

// message and key are just strings
// function returns decrypted string
function sym_decrypt(message, key)
{
  var ivec = new Array(
    0x12, 0x34, 0x56, 0x78, 
    0x12, 0x34, 0x56, 0x78,
    0x12, 0x34, 0x56, 0x78,
    0x12, 0x34, 0x56, 0x78
  );

  return aesCfb(message, key, ivec, 0);
}

function sym_encrypt_padded(message, key)
{
  return sym_encrypt(make_pad(message, 64), key);
}

function sym_decrypt_padded(message, key)
{
  return un_pad(sym_decrypt(message, key));
}
