mxml
private function doEncrypt():void{
var thisStr:String = "123456";
var encryptWord:String = "";
for(var i:Number=0;i<thisStr.length;i++){
if(i<(thisStr.length-1)){
encryptWord += (thisStr.charCodeAt(i)*73+123)+"%";
}
else{
encryptWord += (thisStr.charCodeAt(i)*73+123)+"";
}
}
Alert.show(encryptWord);
}
后台java
public String getMWStr(String codeStr){
String MWStr = "";
String[]chars=codeStr.split("%");
for(int i=0;i<chars.length;i++){
MWStr+=(char)((Integer.parseInt(chars[i])-123)/73);
}
return MWStr;
}