public static function rmd5($action, $key, $str)
	{
		$ret = '';
		$ctr = 0;
		if ($action == 'encrypt') {
			srand((double)microtime()*1000000);
			$salt = md5(rand(0, 32000));
			for ($i=0; $i<strlen($str); $i++) {
				if ($ctr == strlen($salt)) {
					$ctr = 0;
				}
				$ret .= substr($salt, $ctr, 1).( substr($str, $i, 1)^substr($salt, $ctr, 1) );
				$ctr++;
			}
			$ret = self::rmd5('keyed', $key, $ret);
			$ret = base64_encode($ret);
		} elseif ($action == 'decrypt') {
			$str = base64_decode($str);
			$str = self::rmd5('keyed', $key, $str);
			for ($i=0; $i<strlen($str); $i+=2) {
				$ret .= substr($str, $i, 1)^substr($str, $i+1, 1);
			}
		} elseif ($action == 'keyed') {
			$key = md5($key);
			for ($i=0; $i<strlen($str); $i++) {
				if ($ctr == strlen($key)) {
					$ctr = 0;
				}
				$ret .= substr($str, $i, 1)^substr($key, $ctr, 1);
				$ctr++;
			}
		}
		return $ret;
	}