List of usage examples for org.springframework.util DigestUtils md5Digest
public static byte[] md5Digest(InputStream inputStream) throws IOException
From source file:com.sunflower.petal.service.UserService.java
public String md5Twice(String password) { try {/*from w w w. ja va2s . co m*/ byte[] b = DigestUtils.md5Digest(DigestUtils.md5Digest(password.getBytes("UTF-8"))); return new String(b, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("login failed"); } }
From source file:br.vschettino.forum.dao.UsuarioDAOImpl.java
private boolean validatePassword(Usuario visitante, String senha) { byte[] senhaBytes = (DigestUtils.md5Digest(senha.getBytes())); return (visitante.getSenha().equals(DigestUtils.md5DigestAsHex(senha.getBytes()))); }
From source file:eu.openanalytics.rsb.component.DataDirectoriesResource.java
@PostConstruct public void setupRootMap() throws IOException { final List<File> dataDirectoryRoots = getConfiguration().getDataDirectories(); if (dataDirectoryRoots != null) { for (final File dataDirectoryRoot : dataDirectoryRoots) { final String rootKey = Base64.encodeBase64URLSafeString( DigestUtils.md5Digest(dataDirectoryRoot.getCanonicalPath().getBytes())); rootMap.put(rootKey, dataDirectoryRoot); }// w w w . j a va2 s . c o m } }
From source file:org.mule.module.mongo.MongoObjectStore.java
private ObjectId getObjectIdFromKey(final byte[] keyAsBytes) { // hash the key and combine the resulting 16 bytes down to 12 final byte[] md5Digest = DigestUtils.md5Digest(keyAsBytes); final byte[] id = ArrayUtils.subarray(md5Digest, 0, 12); for (int i = 0; i < 4; i++) { id[i * 3] = (byte) (id[i * 3] ^ md5Digest[12 + i]); }/*w w w . j av a 2s . c om*/ final ObjectId objectId = new ObjectId(id); return objectId; }