Red de conocimiento informático - Problemas con los teléfonos móviles - Construcción de estructura

Construcción de estructura

La contraseña se puede cifrar usando SHA.

Le doy un ejemplo de cifrado, JAVA viene con él

string pública estática hashMessage(String message){

MessageDigest md

prueba {

md = MessageDigest.getInstance("SHA"

} catch (java.security.NoSuchAlgorithmException e) {

lanzar nueva RuntimeException(e. getMessage());

}

md = MessageDigest.

md.update(message.getBytes());

Devuelve nuevo BigInteger(md.digest()).toString()

} p>

El siguiente es un cifrado más detallado

public class sha1 {

private int a = 0x67452301

private int b = 0xefcdab89;

p>

privado int c = 0x98badcfe;

privado int d=0x10325476

privado int e=0xc3d2e1f0; > privado int tmpData[] = nuevo int[80];

privado int tmpInt = 0

público sha1() {

}

inicio vacío privado ( ) {

a = 0x67452301;

b = 0xefcdab89

c = 0x98badcfe

d; = 0x10325476;

e = 0xc3d2e1f0;

tmpInt = 0

for(int i = 0; i < tmpData.

tmpData[i] = 0;

}

}

public void byteToInt(byte byteData[], int i) {

tmpData[tmpInt++] = (( byteData[i] y 0xff)<<24)| ((byteData[i + 1] y 0xff)<<16)| (((byteData[i + 1] y 0xff)<<16 ))| (( byteData[ i + 2] & 0xff)<<8)| (byteData[i + 3] & 0xff

if (tmpInt == 16) {

cifrar();

}

}

}

privado vacío intToByte(intValue, byte byteData[], int i ) {

byteData[i] = (byte)(intValue>>>24);

byteData[i + 1] = (byte)(intValue>>>16);

byteData[i + 2] = (byte)(intValue>>>8

byteData[i + 3] = (byte)intValue

}