以下是用于屏蔽字符串的php函数。有人可以给我这个函数的均衡动作。
public static function simple_encrypt($input) {
$return = array();
for($i = 0; $i < strlen($input); $i++){
$ascii = ord(substr($input, $i, 1)) * 2;
$return[] = base_convert($ascii, 10, 32);
}
return sprintf('RL%s', implode('', $return) ); // "RL" ensures it starts with a letter
}
答案 0 :(得分:2)
public static function simple_encrypt(input:String):String {
var ret = [];
var ascii:Number;
for(var i:Number = 0; i < input.length; i++) {
ascii = input.charCodeAt(i) * 2;
ret.push(ascii.toString(32));
}
//I don't speak php, so I am assuming that
//RL doesn't have any syntactical meaning with sprintf
return "RL" + ret.join(''); //joins everything to a single string.
}