Package jonelo.jacksum.algorithm

Examples of jonelo.jacksum.algorithm.AbstractChecksum


  private static final String WHIRLPOOL = "whirlpool";
 
  @Override
  public String encodePassword(String rawPass, Object salt) {
    String encodedPassword = null;
    AbstractChecksum checksum = null;
    try {
      checksum = JacksumAPI.getChecksumInstance(WHIRLPOOL);
    } catch (NoSuchAlgorithmException exc) {
      log.error(null, exc);
      return null;
    }
    checksum.update(rawPass.getBytes());
    encodedPassword = checksum.getFormattedValue();
    return encodedPassword;
  }
View Full Code Here


   * @param password String
   * @return String * @throws Exception
   */
  public String encrypt(String password) throws Exception
  {
    AbstractChecksum checksum = JacksumAPI.getChecksumInstance(name);
    checksum.setEncoding("BASE64");
    checksum.update(password.getBytes());
    return checksum.format("#CHECKSUM");
  }
View Full Code Here

  }

  @Override
  public String encrypt(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException
  {
    AbstractChecksum whirlpool2 = JacksumAPI.getChecksumInstance("whirlpool2");
    whirlpool2.setEncoding("BASE64");
    whirlpool2.update(password.getBytes("UTF-8"));
    return whirlpool2.format("#CHECKSUM");
  }
View Full Code Here

  }

  @Override
  public String encrypt(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException
  {
    AbstractChecksum whirlpool2 = JacksumAPI.getChecksumInstance("whirlpool2");
    whirlpool2.update(password.getBytes("UTF-8"));
    byte[] stdHash = whirlpool2.getByteArray();
    whirlpool2 = JacksumAPI.getChecksumInstance("whirlpool2");
    whirlpool2.setEncoding("BASE64");
    whirlpool2.update(Config.DOUBLE_WHIRPOOL_SALT.getBytes("UTF-8"));
    whirlpool2.update(stdHash);
    String pt1 = whirlpool2.format("#CHECKSUM");
    whirlpool2 = JacksumAPI.getChecksumInstance("whirlpool2");
    whirlpool2.setEncoding("BASE64");
    whirlpool2.update(stdHash);
    whirlpool2.update((Config.DOUBLE_WHIRPOOL_SALT + pt1).getBytes("UTF-8"));
    String pt2 = whirlpool2.format("#CHECKSUM");
    return pt1 + '|' + pt2;
  }
View Full Code Here

  }

  @Override
  public String encrypt(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException
  {
    AbstractChecksum sha1 = JacksumAPI.getChecksumInstance("sha1");
    sha1.setEncoding("BASE64");
    sha1.update(password.getBytes("UTF-8"));
    return sha1.format("#CHECKSUM");
  }
View Full Code Here

TOP

Related Classes of jonelo.jacksum.algorithm.AbstractChecksum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.