Home > Database > Mysql Tutorial > Java版Mysql4.1之前的old_password加密算法

Java版Mysql4.1之前的old_password加密算法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:15:46
Original
1289 people have browsed it

Java版Mysql4.1之前的old_password加密算法。 package mytest;public class MySQLOldPassword {public String getMySQLPassword(String password) {long nr = 1345345333L, add = 7, nr2 = 0x12345671L;long tmp = 0;for (int i = 0; i password.length(); i+

Java版Mysql4.1之前的old_password加密算法。
package mytest;

public class MySQLOldPassword {
	public String getMySQLPassword(String password) {
		long nr = 1345345333L, add = 7, nr2 = 0x12345671L;
		long tmp = 0;
		for (int i = 0; i < password.length(); i++) {
			tmp = password.charAt(i);
			if (tmp == ' ' || tmp == '\t') {
				continue;
			}
			nr ^= (((nr & 63) + add) * tmp) + (nr << 8);
			nr2 += (nr2 << 8) ^ nr;
			add += tmp;
		}
		long result_1 = nr & (((long) 1L << 31) - 1L);
		long result_2 = nr2 & (((long) 1L << 31) - 1L);

		String str1 = Long.toHexString(result_1);
		String str2 = Long.toHexString(result_2);
		return str1.concat(str2);
	}

	public static void main(String args[]) {
		System.out.print(new MySQLOldPassword().getMySQLPassword("qq123456"));
	}
}


Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template