List of usage examples for org.apache.commons.codec.digest DigestUtils md5Hex
public static String md5Hex(String data)
From source file:com.lingxiang2014.controller.admin.ProfileController.java
@RequestMapping(value = "/check_current_password", method = RequestMethod.GET) public @ResponseBody boolean checkCurrentPassword(String currentPassword) { if (StringUtils.isEmpty(currentPassword)) { return false; }// w ww. j a v a2s . c o m Admin admin = adminService.getCurrent(); if (StringUtils.equals(DigestUtils.md5Hex(currentPassword), admin.getPassword())) { return true; } else { return false; } }
From source file:com.teamj.distribuidas.servicios.UsuarioServicio.java
public boolean insertar(Usuario u) throws ValidationException { boolean flag = false; Usuario temp = new Usuario(); temp.setNombre(u.getNombre());/*w w w. j a v a 2 s . c o m*/ List<Usuario> tempList = this.usuarioDAO.find(temp); if (tempList == null || tempList.isEmpty()) {//el nombre de usuario no existe try { String codecPassword = DigestUtils.md5Hex(u.getPassword()); u.setPassword(codecPassword); u.setActivo("Y"); this.usuarioDAO.insert(u); flag = guardarMochilaFactura(u.getId()); } catch (Exception e) { throw new ValidationException(e, "Error al crear el nuevo usuario"); } } return flag; }
From source file:kitt.admin.service.UserService.java
/** * ??//from w ww .j a va 2 s .c o m * @param securephone ? * @return true or false * @throws Exception */ @Transactional public boolean doResetPasswordMethod(String securephone) throws Exception { String randompwd = code.CreateCode(); if (userMapper.modifyPasswdByPhone(DigestUtils.md5Hex(randompwd), securephone) == 1) { MessageNotice.CommonMessage.noticeUser(securephone, "??" + randompwd); return true; } throw new BusinessException("?????"); }
From source file:com.github.jramos.snowplow.operators.UserIdHashOp.java
@Override public SnowplowEventModel apply(SnowplowEventModel event) { try {//from w w w. ja va 2 s . c om String userId = DigestUtils.md5Hex(event.getUser_id()); event.setUser_id(userId); } catch (Exception e) { LOG.error("Exception applying operator to userId " + event.getUser_id(), e); } return event; }
From source file:com.github.jramos.snowplow.operators.IPAddressHashOp.java
@Override public SnowplowEventModel apply(SnowplowEventModel event) { try {//from w w w. jav a2 s . c o m String ipAddress = DigestUtils.md5Hex(event.getUser_ipaddress()); event.setUser_ipaddress(ipAddress); } catch (Exception e) { LOG.error("Exception applying operator to user IP address " + event.getUser_ipaddress(), e); } return event; }
From source file:be.solidx.hot.Script.java
public Script(byte[] code, String name) { this.code = code; this.name = name; md5 = DigestUtils.md5Hex(code); }
From source file:lucee.commons.digest.Hash.java
public static String md5(Resource res) throws NoSuchAlgorithmException, IOException { InputStream is = res.getInputStream(); try {/*from ww w .j a va 2 s . c om*/ return DigestUtils.md5Hex(is); } finally { IOUtil.closeEL(is); } }
From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.Mensaje.java
private void completarMensaje() { cabecera.setIdMensaje(((CuerpoInterface) cuerpo).getIdMensaje()); cabecera.setLongitudCuerpo(cuerpo.asTexto().length() + ""); cabecera.setVerificacion(DigestUtils.md5Hex(cabecera.asTexto())); }
From source file:com.teamj.arquitectura.subscripcion.services.AdministradorServicio.java
public boolean registrarAdmi(Administrador a) throws ValidationException { boolean flag = false; Administrador temp = new Administrador(); try {/*from w w w . j a v a 2 s .c om*/ temp.setEmail(a.getEmail()); String codecPassword = DigestUtils.md5Hex(a.getPassword()); temp.setPassword(codecPassword); //temp.setPassword(a.getPassword()); temp.setEstado(a.getEstado()); administradorDAO.insert(temp); flag = true; } catch (Exception e) { throw new ValidationException("Error al crear un nuevo usuario", e); } return flag; }
From source file:io.muic.ooc.webapp.service.SecurityService.java
public boolean authenticate(String username, String password, HttpServletRequest request) { // String passwordInDB = userCredentials.get(username); // boolean isMatched = StringUtils.equals(password, passwordInDB); try {//from w ww . j a va 2 s .c om MySQLService sql = new MySQLService(); String digest = DigestUtils.md5Hex(password); boolean isMatched = sql.checkMatch(username, digest); System.out.println(isMatched); if (isMatched) { request.getSession().setAttribute("username", username); return true; } else { return false; } } catch (Exception e) { System.out.println(e); } return false; }