//加密字符串
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
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
解决方案 »
- 急求用Objective-c编写的网络爬虫源代码!!
- 按键问题,代码编译没有语法问题,可是出现了这些! 什么情况?
- Cocos2d-x游戏引擎实战开发炸弹超人项目教程分享
- TableViewCell Remove子视图的问题
- 方法间传值问题
- XCode6中prefix.pch问题
- pickerview越界错误
- ios 百度地图 定位 为什么自己的位置没有小圆点图标
- OC初学者,请问这段代码是什么用法
- ios 多线程多任务并发下载图片资源
- 关于Crash文件的查找问题
- vmware8.0安装mac 时出现错误 hardware virtualization is disabled in the host bios
.h .m一对文件可以直接拖出来用的