Java SHA1 sha1Hash(String source)

Here you can find the source of sha1Hash(String source)

Description

sha Hash

License

Open Source License

Declaration

public static String sha1Hash(String source) throws NoSuchAlgorithmException 

Method Source Code


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

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String sha1Hash(String source) throws NoSuchAlgorithmException {
        MessageDigest digest = MessageDigest.getInstance("SHA1");
        digest.update(source.getBytes(), 0, source.length());
        return String.format("%040X", new BigInteger(1, digest.digest()));
    }//from w  w w. j a v  a2s.  c  o  m
}

Related

  1. sha1Hash(String content)
  2. sha1Hash(String input)
  3. sha1Hash(String input)
  4. sha1hash(String key)
  5. sha1Hash(String s)
  6. sha1Hash(String text)
  7. sha1Hash(String tohash)
  8. sha1Hash(String toHash)
  9. sha1HashHex(String data)