Java XML Base64 Encode Decode getHashBase64(String origStr, String digestAlgorithm)

Here you can find the source of getHashBase64(String origStr, String digestAlgorithm)

Description

get Hash Base

License

Open Source License

Declaration

public static String getHashBase64(String origStr, String digestAlgorithm) throws NoSuchAlgorithmException 

Method Source Code

//package com.java2s;
/**//from  w w  w . j  a  v  a2 s.  co m
* License: https://github.com/votingsystem/votingsystem/wiki/Licencia
*/

import javax.xml.bind.DatatypeConverter;

import java.security.*;

public class Main {
    public static String getHashBase64(String origStr, String digestAlgorithm) throws NoSuchAlgorithmException {
        MessageDigest sha = MessageDigest.getInstance(digestAlgorithm);
        byte[] resultDigest = sha.digest(origStr.getBytes());
        return DatatypeConverter.printBase64Binary(resultDigest);
    }
}

Related

  1. encodeBase64(String stringValue)
  2. encodeBase64Binary(byte[] data)
  3. fromBase64(String base64)
  4. fromBase64(String hex)
  5. getBase64(byte[] bytes)
  6. readBase64Bytes(String str)
  7. readFileToBase64(String filePath)
  8. sha256SaltBase64(String password, String salt)
  9. toB64(byte[] bytes)