Gente alguem me ajuda!!!!!! o código abaixo deveria dar o seguinte
resultado:
A04B1463233AAC6C
OU
50848C12479500B7
O problema eh q esta dando o seguinte resultado:
????????
Abaixo o codigo:
import java.applet.*;
import java.util.Random; public class teste extends Applet { public void init() { int cookie; String s; s = "FERNANDO"; buf = new StringBuffer(s); cookie=(new Random()).nextInt() ^ hashCode(); char ac[] = new char[2]; ac[0] = (char)(cookie & 0xffff); ac[1] = (char)(cookie >>> 16 & 0xffff); System.out.println("senha = " + buf); System.out.println("cookie = " + cookie); System.out.println("ac0 = " + ac[0]); System.out.println("ac1 = " + ac[1]); int i = 0; for(int j = 0; i < buf.length(); j = j != 0 ? 0 : 1) { buf.setCharAt(i, (char)(ac[j] ^ buf.charAt(i))); System.out.println("c"+ i +" = " + buf); i++; } System.out.println("CHAVE = " + buf); } private StringBuffer buf; } |
Title: E-Bee Sistemas