Expermicid Posted October 10, 2012 Share Posted October 10, 2012 (edited) Para practicar un poco java, traslade este algoritmo de encryptacion de string. Encryptacion: [lenguaje=java]private static String Encryptar(String sText, String sPass) { int x; int aux = 0; int iPass = 0; String result; result = ""; for (x=0;x iPass = iPass + ((int)sPass.charAt(x)); } for (x=0;x aux = (int)sText.charAt(x) + iPass + x; while (aux > 255) { aux = aux - 255; } result = result + (char)aux; } return result; }[/lenguaje] Desencryptacion: [lenguaje=java]private static String Desencryptar(String sText, String sPass) { int x; int aux = 0; int iPass = 0; String result; result = ""; for (x=0;x iPass = iPass + ((int)sPass.charAt(x)); } for (x=0;x aux = (int)sText.charAt(x) - iPass - x; while (aux < 0) { aux = aux + 255; } result = result + (char)aux; } return result; }[/lenguaje] En funcionamiento This is the hidden content, please Sign In or Sign Up Saludos Edited February 16, 2014 by Expermicid Link to comment Share on other sites More sharing options...
Recommended Posts