不需要调用携带JS ,直接用AAuto源码实现QQ密码加密 原来算法代码参照 JS 思路
补充:9楼 优化后的代码
[代码] AAuto
07 | uin2hex= function (str) { |
08 | var hex = string.right( tostring( tonumber(str,10) ,16) ,-3) |
09 | hex = string.repeat(16 - #hex,"0") ++ hex; |
10 | return crypt.bin.decodeHex(hex) |
13 | getEncryption= function (password, qq, vcode) { |
14 | var str1 = crypt.bin.decodeHex(crypt.md5(password)); |
15 | var str2 = crypt.md5(str1 + uin2hex(qq) ); |
16 | return crypt.md5(str2 + string.upper(vcode)); |
19 | enpass = getEncryption( "hello" , "99808099" , '!GVT' ) |
[代码] AAuto
05 | uin2hex= function (str) { |
07 | var str=tonumber(str,10) |
08 | var hex = tostring(str,16) |
09 | var hex=string.sub(hex,3, #hex) |
10 | for ( i = #hex; maxLength-1;1) { |
14 | for ( j = 1; maxLength;2) { |
15 | table.push(arr, "\x" + string.sub(hex,j,j+1)) |
17 | var result =string.join(arr, "" ); |
18 | result=eval( "'" +result + "'" ); |
22 | hexchar2bin= function (str) { |
25 | table.push(arr, "\x" + string.sub(str,i,i+1)) |
27 | var arr = string.join(arr, "" ); |
28 | temp=eval( "'" +arr+ "'" ) |
32 | getEncryption= function (password, qq, vcode) { |
34 | var str1 = hexchar2bin(string.md5(password)); |
35 | var str2 = string.md5(str1 + uin); |
36 | var str3 = string.md5(str2 + string.upper(vcode)); |
40 | enpass=getEncryption(pass,qq,vcode) |
开源中国-程序员在线工具:API文档大全(120+) JS在线编辑演示 二维码 更多?
引用来自“notishell”的评论
引用来自“子峰”的评论
引用来自“notishell”的评论
引用来自“notishell”的评论
引用来自“子峰”的评论
引用来自“notishell”的评论
请问你的vcode从哪里来?
引用来自“紫薯饼”的评论
请问你的vcode从哪里来?
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
import crypt;
import crypt.bin;
import console;
uin2hex=function(str) {
var hex = string.right( tostring( tonumber(str,10) ,16) ,-3)
hex = string.repeat(16 - #hex,"0") + hex;
return crypt.bin.decodeHex(hex)
}
getEncryption=function(password, qq, vcode) {
var str1 = crypt.bin.decodeHex(crypt.md5(password));
var str2 = crypt.md5(str1 + uin2hex(qq) );
return crypt.md5(str2 + string.upper(vcode));
}
enpass = getEncryption("hello","99808099",'!GVT')
console.log( enpass )
@猪圈 的代码并没有包含UIN的转换算法 - 而是直接写在参数里了。
引用来自“猪圈”的评论
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
引用来自“figer1”的评论
import crypt;
import crypt.bin;
import console;
uin2hex=function(str) {
var hex = string.right( tostring( tonumber(str,10) ,16) ,-3)
hex = string.repeat(16 - #hex,"0") + hex;
return crypt.bin.decodeHex(hex)
}
getEncryption=function(password, qq, vcode) {
var str1 = crypt.bin.decodeHex(crypt.md5(password));
var str2 = crypt.md5(str1 + uin2hex(qq) );
return crypt.md5(str2 + string.upper(vcode));
}
enpass = getEncryption("hello","99808099",'!GVT')
console.log( enpass )
引用来自“猪圈”的评论
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
引用来自“lemonseed”的评论
引用来自“猪圈”的评论
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
引用来自“JSON.org.cn”的评论
引用来自“猪圈”的评论
引用来自“lemonseed”的评论
引用来自“猪圈”的评论
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
引用来自“lemonseed”的评论
引用来自“猪圈”的评论
引用来自“lemonseed”的评论
引用来自“猪圈”的评论
package org.chinasb.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
public class TXMD5Utils {
public static final String HEXSTRING = "0123456789ABCDEF";
public static String md5(String originalText) throws Exception {
byte buf[] = originalText.getBytes("ISO-8859-1");
StringBuffer hexString = new StringBuffer();
String result = "";
String digit = "";
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(buf);
byte[] digest = algorithm.digest();
for (int i = 0; i < digest.length; i++) {
digit = Integer.toHexString(0xFF & digest[i]);
if (digit.length() == 1) {
digit = "0" + digit;
}
hexString.append(digit);
}
result = hexString.toString();
} catch (Exception ex) {
result = "";
}
return result.toUpperCase();
}
public static String hexchar2bin(String md5str) throws UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(md5str.length() / 2);
for (int i = 0; i < md5str.length(); i = i + 2) {
baos.write((HEXSTRING.indexOf(md5str.charAt(i)) << 4 | HEXSTRING.indexOf(md5str.charAt(i + 1))));
}
return new String(baos.toByteArray(), "ISO-8859-1");
}
/**
*
* @param qq http://check.ptlogin2.qq.com/check?uin={0}&appid=15000101&r={1} 返回的第三个值
* @param password QQ密码
* @param verifycode 验证码
* @return 加密后的密码
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static String getPassword(String qq, String password, String verifycode) throws Exception {
String P = hexchar2bin(md5(password));
String U = md5(P + hexchar2bin(qq.replace("\\x", "").toUpperCase()));
String V = md5(U + verifycode.toUpperCase());
return V;
}
public static void main(String[] args) throws Exception {
System.out.println(getPassword("\\x00\\x00\\x00\\x00\\x03\\x7b\\xab\\x09", "zhujuan", "FPDS"));
}
}
hex = string.repeat(16 - #hex,"0") ++ hex;
否则如果 hex 是纯数字,AAuto 会理解为算数运算符。