Java SHA1 SHA1(String text)

Here you can find the source of SHA1(String text)

Description

SHA

License

Open Source License

Declaration

public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException 

Method Source Code

//package com.java2s;

import java.io.UnsupportedEncodingException;

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

public class Main {
    static public final String SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";

    public static byte[] SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest md;/*  w w w  .  java 2 s .c  om*/
        md = MessageDigest.getInstance("SHA-1");
        byte[] sha1hash = new byte[40];
        md.update(text.getBytes(), 0, text.length());
        // "iso-8859-1"
        sha1hash = md.digest();
        return (sha1hash);
    }
}

Related

  1. SHA1(String strs)
  2. sha1(String text)
  3. SHA1(String text)
  4. sha1(String text)
  5. SHA1(String text)
  6. SHA1(String text)
  7. sha1(String text)
  8. SHA1(String texto)
  9. sha1(String txt)