This commit is contained in:
parent
580e1ad3d3
commit
2cd34c6386
@ -46,7 +46,7 @@ public class NouveauPompForm {
|
||||
if (erreur > 0) return -1;
|
||||
|
||||
// Creation d'un objet de type Client avec les données transmises
|
||||
// String mdpChiffre = MD5.encode(request.getParameter("ztMDP"));
|
||||
String mdpChiffre = MD5.encode(request.getParameter("ztMDP"));
|
||||
Pompier unPompier = new Pompier(request.getParameter("id"),
|
||||
request.getParameter("idCaserne"),
|
||||
request.getParameter("ztNom"),
|
||||
|
36
src/java/util/MD5.java
Normal file
36
src/java/util/MD5.java
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sio
|
||||
*/
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class MD5 {
|
||||
|
||||
public static String encode(String uneChaine){
|
||||
MessageDigest md = null;
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new IllegalArgumentException(ex);
|
||||
}
|
||||
md.update(uneChaine.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
//myHash = DatatypeConverter.printHexBinary(digest).toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : digest) {
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user