Trasladé todo el código del Xor de Visual Basic a Java y funciona excelente:

Aprovecho a decirles que estoy inactivo en el foro porque este es mi último año en la secundaria y lo estoy disfrutando al máximo, pero no me olvido de Indetectables

[Enlace externo eliminado para invitados]

Código: Seleccionar todo

/** --------------------------------------------
 *   @Author KainRazor
 *   @WebSite www.Indetectables.net
 *   @IDE Java Eclipse Helios x64
 *   @Purpose Simple Xor Encryption/Decryption
 *   @Credits Fredrik Qvarfort (Author)
 *  --------------------------------------------
 */

class Xor {
	
	private static byte m_KeyArray[];
	private static int m_KeyLen;
	private static String m_KeyValue;
	
	/* How To Use
	public static void main(String[] args) {
		
		final String sCode = "Indetectables";
		
		String eCode = Encrypt_String(sCode, "1234hf999095");
		
		String dCode = Decrypt_String(eCode, "1234hf999095");
		
			System.out.println("|| jXor Encryption/Decryption By KainRazor ||\n" +
				"\nReal String: "+sCode+"\nEncoded String: "+eCode+"\nDecoded String: "+dCode);
	}
	*/
	
	private static String Encrypt_String(String Text, String Key) {
		byte ByteArray[] = Conv_FromUnicode(Text);

		Encrypt_Byte(ByteArray, Key);
		
		return Conv_ToUnicode(ByteArray);
	}
	
	private static String Decrypt_String(String Text, String Key) {
		byte ByteArray[] = Conv_FromUnicode(Text);

		Decrypt_Byte(ByteArray, Key);
		
		return Conv_ToUnicode(ByteArray);
	}

	private static byte[] Encrypt_Byte(byte ByteArray[], String Key) {
		long ByteLen = ByteArray.length;
		
		Key_Handles(Key);
		
		for(int Offset = 0; Offset < ByteLen; Offset++) {
			ByteArray[Offset] = (byte) (ByteArray[Offset] ^ m_KeyArray[(Offset % m_KeyLen)]); // ^ = 
		}
			return ByteArray;
	}
	
	private static byte[] Decrypt_Byte(byte[] ByteArray, String Key) {

		return Encrypt_Byte(ByteArray, Key);
		
	}
	
	private static void Key_Handles(String Key) {
		if(Key.length() != 0) {
			m_KeyValue = Key;
			m_KeyLen = Key.length();
			m_KeyArray = Conv_FromUnicode(m_KeyValue);
		}
	}
	
	private static byte[] Conv_FromUnicode(String sTrans) {
		byte[] bFinal = sTrans.getBytes();

		return bFinal;
	}
	
	private static String Conv_ToUnicode(byte[] bTrans) {
		 String sFinal = new String(bTrans);

		 return sFinal;
	}
}
Imagen
Responder

Volver a “Otros lenguajes”