Example usage for org.apache.shiro.crypto.hash Sha512Hash Sha512Hash

List of usage examples for org.apache.shiro.crypto.hash Sha512Hash Sha512Hash

Introduction

In this page you can find the example usage for org.apache.shiro.crypto.hash Sha512Hash Sha512Hash.

Prototype

public Sha512Hash(Object source, Object salt) 

Source Link

Usage

From source file:de.fatalix.bookery.bl.model.AppUser.java

License:Open Source License

/**
 * Sets the password in human readable format. The password will internally
 * be hashed./* w  ww  . j a  va 2  s . c o  m*/
 * 
 * @param password
 */
public void setHumanReadablePassword(String password) {
    this.password = new Sha512Hash(password, AppUserAuthenticationInfo.PW_SALT).toHex();
}

From source file:org.cherchgk.actions.settings.BaseSettingsAction.java

License:Apache License

public void setMailServerPassword(String mailServerPassword) {
    String password = settingsService.getMailServerPassword();
    if (password == null) {
        this.mailServerPassword = mailServerPassword;
    } else {//from   w ww  .  j  a  v a  2  s .c  o m
        String passwordHash = new Sha512Hash(password, SecurityUtils.getSubject().getPrincipal().toString())
                .toHex();
        if (passwordHash.substring(0, 7).equals(mailServerPassword)) {
            this.mailServerPassword = password;
        } else {
            this.mailServerPassword = mailServerPassword;
        }
    }
}

From source file:org.cherchgk.actions.settings.SettingsAction.java

License:Apache License

public String getMailServerPassword() {
    String password = settingsService.getMailServerPassword();
    if (password == null) {
        return null;
    }/*from   w  ww  .  j a v  a 2s .c o  m*/
    String passwordHash = new Sha512Hash(password, SecurityUtils.getSubject().getPrincipal().toString())
            .toHex();
    return passwordHash.substring(0, 7);
}