Login
...or Sign up
Home
Search
Search Code Snippets
Search People
Code Snippets of
cara
public static String encryptMD5(String code){ try{ MessageDigest md = MessageDigest.getInstance("MD5"); byte[] input = code.getBytes(); //"UTF8"); input=md.digest(input); code = toHexadecimal(input); //new String(input,"UTF8"); return code; }catch(Exception e){ return code; } } private static String toHexadecimal(byte[] datos) { String resultado=""; ByteArrayInputStream input = new ByteArrayInputStream(datos); String cadAux; boolean ult0=false; int leido = input.read(); while(leido != -1) { cadAux = Integer.toHexString(leido); if(cadAux.length() < 2){ //Hay que aÒadir un 0 resultado += "0"; if(cadAux.length() == 0) ult0=true; }else{ ult0=false;} resultado += cadAux; leido = input.read(); } if(ult0)//quitamos el 0 si es un caracter aislado resultado= resultado.substring(0, resultado.length()-2)+resultado.charAt(resultado.length()-1); return resultado; } }
Hash MD5 with Java
Uploaded on
3/21/2008 8:28:10 AM
0 comments
Programming Language:
Java
hash
java
md5
public static String decrypt3DES(String code, SecretKey key) throws NoSuchAlgorithmException, InvalidKeyException, IOException, IllegalBlockSizeException, NoSuchPaddingException, BadPaddingException { Cipher cipher = Cipher.getInstance("DESede"); cipher.init(Cipher.DECRYPT_MODE, key); BASE64Decoder decoder = new BASE64Decoder(); byte[] raw = decoder.decodeBuffer(code); byte[] stringBytes = cipher.doFinal(raw); String result = new String(stringBytes,"UTF8"); return result; } public static String encrypt3DES(String code, SecretKey key) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, IOException, IllegalStateException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("DESede"); cipher.init(Cipher.ENCRYPT_MODE,key); byte[] stringBytes=code.getBytes("UTF8"); byte[] raw=cipher.doFinal(stringBytes); BASE64Encoder encoder = new BASE64Encoder(); String base64 = encoder.encode(raw); return base64; }
Crypt and Decrypt with Java
Uploaded on
3/21/2008 8:26:44 AM
0 comments
Programming Language:
java
crypt
decrypt
java
import java.applet.Applet; import java.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello world", 10, 10); } }
Hello World Java Applet
Uploaded on
6/20/2007 12:00:47 PM
0 comments
Programming Language:
java
applet
java
function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); //Not IE } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); //IE } else { alert("Your browser doesn't support the XmlHttpRequest object."); } }
Cross-Browser XMLHttpRequest
Uploaded on
6/20/2007 11:30:44 AM
0 comments
Programming Language:
javascript
AJAX
XMLHttpRequest
<param-name>config</param-name> <param-value> /WEB-INF/struts-config.xml,/WEB-INF/other_struts_config.xml </param-value>
Multiple struts-config.xml
Uploaded on
6/8/2007 4:55:03 AM
0 comments
Programming Language:
xml
java
struts
struts-config
1
2
3
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com