将弱加密算法从PHP转换为Coldfusion或Java

I'm working with someone that is having me 'encrypt' some text I send to his webservice using the function listed below. I've tried to translate these into Coldfusion but my output doesn't match his version. I would rather simply use AES 256 and call it a day, but I literally have no choice as this is what they use. Can someone please help me translate this into either Coldfusion or Java.

function encrypt($string, $key) {
  $result = '';
  for($i=0; $i<strlen($string); $i++) {
    $char = substr($string, $i, 1);
    $keychar = substr($key, ($i % strlen($key))-1, 1);
    $char = chr(ord($char)+ord($keychar));
    $result.=$char;
}

  return base64_encode($result);
}

function decrypt($string, $key) {
  $result = '';
  $string = base64_decode($string);

  for($i=0; $i<strlen($string); $i++) {
    $char = substr($string, $i, 1);
    $keychar = substr($key, ($i % strlen($key))-1, 1);
    $char = chr(ord($char)-ord($keychar));
    $result.=$char;
  }

    return $result;
} 

My Coldfusion versions:

function hideText(argsString, key) {
  var result = '';
  for(i=1; i <= len(argsString); i++) {
    char = mid(argsString, i, 1);
    keychar = mid(key, i, 1);
    char = asc(ord(char) & ord(keychar));
    result &= char;
  }
    return toBase64(result);
}

function unHideText(argsString, key) {
  result = '';
  string = toString( ToBinary( argsString ) );

  for(i=1; i<= strlen(argsString); i++) {
    char = mid(argsString, i, 1);
    keychar = mid(key, i, 1);
    char = asc(ord(char) - ord(keychar));
    result &= char;
  }
    return result;
}

function ord(any argString){
    return Left(argString, 1);
}

My CF version isn't using the % as I think that might just evaluate to the same thing as i does anyway - and it actually produces a result without it. Though I may be missing why it was there in the first place. Anyone use both PHP and CF have any insight into a better translation? If its easier to explain in java I'm perfectly comfortable with that as well.

Remove your ord function.

This line in your CF:

char = asc(ord(char) & ord(keychar));

should be:

char = Chr(Asc(char) + Asc(keychar));