//加密字符串
public function bluview_encrypt($e_string, $password = 'fenlei')
{
    $password = base64_encode($password);
    $count_pwd = strlen("a".$password);
    $pwd = '';
    for($i = 1; $i<$count_pwd; $i++) {
        $pwd += ord($password{$i});
    }
    
    $e_string = base64_encode($e_string);
    $count = strlen("a".$e_string);
    $asciis = '';
    for($i = 0; $i<$count; $i++) {
        $asciis .= (ord($e_string{$i})+$pwd)."|";
    }
    
    $asciis = base64_encode($asciis);
    return $asciis;
} //解密字符串
public function bluview_decrypt($e_string, $password = 'fenlei')
{
$password = base64_encode($password);
    $count_pwd = strlen("a".$password);
    for($i = 1;$i<$count_pwd;$i++) {
     $pwd+=ord($password{$i});
    }
    
    $e_string = base64_decode($e_string);
    $contents = explode("|",$e_string);
    $count = count($contents);
    for ($i=0;$i<$count;$i++){
     $infos.=chr($contents[$i]-$pwd);
    }
    $asciis = base64_decode($infos);
private static final String KEY = "fenlei"; public static String decrypt(String ciphertext) {
if(TextUtil.isEmpty(ciphertext))
return null;
byte[] encryptedKeyBytes = Base64.encode(KEY.getBytes(), Base64.NO_WRAP);
String encryptedKey = "";
for (byte b : encryptedKeyBytes) {
encryptedKey += new String(new byte[] { b });
} int pwd = 0;
for (int i = 1; i < encryptedKey.length(); i++) {
pwd+=encryptedKey.charAt(i);
} String encryptedText = "";
byte[] encryptedTextArr = Base64.decode(ciphertext, Base64.DEFAULT);
for (byte b : encryptedTextArr) {
encryptedText += new String(new byte[] { b });
}
String[] encryptedTextArr2 = encryptedText.split("\\|"); String encryptedText2 = "";
for (int i = 0; i < encryptedTextArr2.length; i++) {
encryptedText2 += (char) (Integer.valueOf(encryptedTextArr2[i]) - pwd);
} String text = "";
byte[] bytes = Base64.decode(encryptedText2, Base64.DEFAULT);
for (byte b : bytes) {
text += new String(new byte[] { b });
}
return text;
}
后台的php