Java Hash Calculate getHash(String pass, String algorithm)

Here you can find the source of getHash(String pass, String algorithm)

Description

get Hash

License

Open Source License

Declaration

private static byte[] getHash(String pass, String algorithm) throws NoSuchAlgorithmException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    private static byte[] getHash(String pass, String algorithm) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance(algorithm);
        md.update(pass.getBytes());//  www. j a va2s . c o m
        byte[] hash = md.digest();
        return hash;
    }
}

Related

  1. getHash(String givenStr)
  2. getHash(String input)
  3. getHash(String input)
  4. getHash(String key)
  5. getHash(String message)
  6. getHash(String password, byte[] salt)
  7. getHash(String password, byte[] salt)
  8. getHash(String password, String bsalt)
  9. getHash(String password, String salt)