Location解密修正版
2014-10-25 07:59
597 查看
上一版本的解密算法有些问题,在某些情况下对不齐,容易解密失败。调试了一天的新算法,贴上来保存。也能帮助后来人:
QString Dialog::DecodeXiamiLocation(QString location)
{//解码虾米音乐凯撒矩阵算法
if(!(location.data()[0].isDigit()))
return "ERROR";
int num=location.data()[0].digitValue();
QString loc=location.mid(1,location.length()-1);
int avg_len=loc.length()/num;
int remainder=loc.length()%num;
for(int i=0;i<num-remainder;i++)
loc.insert((remainder*(avg_len+1)+avg_len*(i+1))+i,'~');
int lineLen=loc.length()/num;
QString ret;
for(int j=0;j<lineLen;j++)
for(int i=0;i<num;i++)
ret.append(loc.at(i*lineLen+j));
ret=QUrl::fromPercentEncoding(ret.remove('~').toLocal8Bit()).replace('^','0');
return ret;
}
目前的半成品下载器预览图:
QString Dialog::DecodeXiamiLocation(QString location)
{//解码虾米音乐凯撒矩阵算法
if(!(location.data()[0].isDigit()))
return "ERROR";
int num=location.data()[0].digitValue();
QString loc=location.mid(1,location.length()-1);
int avg_len=loc.length()/num;
int remainder=loc.length()%num;
for(int i=0;i<num-remainder;i++)
loc.insert((remainder*(avg_len+1)+avg_len*(i+1))+i,'~');
int lineLen=loc.length()/num;
QString ret;
for(int j=0;j<lineLen;j++)
for(int i=0;i<num;i++)
ret.append(loc.at(i*lineLen+j));
ret=QUrl::fromPercentEncoding(ret.remove('~').toLocal8Bit()).replace('^','0');
return ret;
}
目前的半成品下载器预览图:
相关文章推荐
- curl问题的修正curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir
- SQLite 3.7.13的加密解密(五)—— 修正编译错误和警告
- C# Java 3DES加密解密 扩展及修正\0 问题
- CLLocation与mapkit(中国)的偏移处理办法add 修正偏差的处理另外办法,利用MKMapView *_mapView获取location消除误差;
- SQL SERVER 2008破解加密存储过程(修正存储过程过长解密出来是空白的问题)
- SQLite 3.7.13的加密解密(五)—— 修正编译错误和警告
- SQLite 3.7.13的加密解密(五)—— 修正编译错误和警告
- aspnet_regiis加密的web.config解密工具
- c# aes 加密解密
- CrackMe.exe 解密流程
- jQuery技术解密二
- android sdk location should not contain whitespace,as this can cause problem with the NDK tools
- IIS 配置节的加密和解密
- js与php加密、解密函数
- Base64加密解密
- 加密每个字符依次反复加上“4962873”中的数字,范围超过ASCII码的032(空格)~122(“z”),则进行模运算,然后解密。
- 加密和解密函数
- Delphi 6 SOAP 源码中的BUG修正
- xiami flash播放器对歌曲链接的解密算法