List of usage examples for org.apache.shiro.crypto.hash SimpleHashRequest SimpleHashRequest
public SimpleHashRequest(String algorithmName, ByteSource source, ByteSource salt, int iterations)
From source file:com.github.richardwilly98.esdms.services.SHA512HashProvider.java
License:Open Source License
private Hash compute(byte[] text) { try {/* w ww.j ava 2s . co m*/ byte[] baseSalt = { 1, 1, 1, 2, 2, 2, 3, 3, 3 }; ByteSource salt = ByteSource.Util.bytes(baseSalt); int iterations = 3; HashRequest request = new SimpleHashRequest(service.getHashAlgorithmName(), ByteSource.Util.bytes(text), salt, iterations); Hash hash = service.computeHash(request); return hash; } catch (Throwable t) { log.error("compute failed", t); throw new NullPointerException("hash"); } }
From source file:to.sauerkraut.krautadmin.auth.PasswordService.java
License:Open Source License
public HashResult hashPassword(final String plainTextPassword) { final Hash computedHash = configurableHashService .computeHash(new SimpleHashRequest(null, ByteSource.Util.bytes(plainTextPassword), null, -1)); return new HashResult(computedHash.toBase64(), Base64.encodeBase64String(computedHash.getSalt().getBytes())); }