这是我无意中写的一个简易的加密方法,现在放出来,其实是因为没有用了,不过是提醒自己,数字要加密而已,所以将这个放了出来,大家也可以看看,有好的加密方法的朋友,可以交流一下 public function NumberConvert() { } public static function getNum(str:String):String{ if(str==null)return null; var _num:String=""; for(var i:int=0;i<str.length;i++){ var tmp:String= str.charAt(i); _num=_num+strToNum(tmp); } return _num; } public static function getString(num:String):String{ if(num==null) return null; var _str:String=""; for(var i:int=0;i<num.length;i++){ var tmp:String=num.charAt(i); _str=_str+numToStr(tmp); } return _str; } private static function numToStr(tmp :String):String{ switch (tmp) { case "0": return "I"; break; case "1": return "O"; break; case "2": return "x"; break; case "3": return "l"; break; case "4": return "C"; break; case "5": return "Z"; break; case "6": return "D"; break; case "7": return "F"; break; case "8": return "S"; break; case "9": return "T"; break; case ".": return "^"; break; default : return "error"; break; } } private static function strToNum(str:String):String{ switch (str) { case "I": return "0"; break; case "O": return "1"; break; case "x": return "2"; break; case "l": return "3"; break; case "C": return "4"; break; case "Z": return "5"; break; case "D": return "6"; break; case "F": return "7"; break; case "S": return "8"; break; case "T": return "9"; break; case "^": return "."; break; default : return "error"; break; } }