⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 password.java.htm

📁 JAVA的加密源程序
💻 HTM
字号:
<html>/*Christoforos Pirillos @ Villanova University - May 1999based on code from the book "Java Network Programming" by Hughes*/package encryption;/**Generates keys from passwords*/public  class Password {/**Converts the supplied String into an array of bytes and returns adigest of this*/public static long keyFromPassword (String password) {	byte[] passwordBytes = new byte[password.length()*2];	for (int i =0; i<password.length();++i) {		char c=password.charAt(i);	passwordBytes[i*2]=(byte) (c>>8);	passwordBytes[i*2+1]=(byte) c;	}	SHS hash = new SHS();	byte[] keyBytes = hash.digest (passwordBytes);	return Crypt.bytesToLong(keyBytes,0);}/**Returns the next key from the digest*/public static long nextKeyFromPassword (String password) {	byte[] passwordBytes = new byte[password.length()*2];	for (int i =0;i<password.length(); ++i) {		char c=password.charAt(i);		passwordBytes[i*2]=(byte)(c>>8);		passwordBytes[i*2+1]=(byte) c;	}	SHS hash = new SHS();	byte[] keyBytes=hash.digest(passwordBytes);	return Crypt.bytesToLong(keyBytes,8);}}/*end of class*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -