Android SHA1 Hash Create sha1(String ori)

Here you can find the source of sha1(String ori)

Description

sha

Declaration

public static String sha1(String ori) 

Method Source Code

//package com.java2s;

import java.math.BigInteger;

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

public class Main {
    public static String sha1(String ori) {
        try {//from   www. j av  a  2s .c o  m
            MessageDigest md = MessageDigest.getInstance("sha1");
            md.update(ori.getBytes(), 0, ori.length());
            BigInteger i = new BigInteger(1, md.digest());
            return String.format("%1$040x", i);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return ori;
        }
    }
}

Related

  1. SHA1(String text)
  2. SHA256(String text)
  3. HashPassword(String text)
  4. sha1(File input)
  5. sha1(String input)
  6. sha1(String ori)
  7. sha1(String s)
  8. sha1(String s)
  9. computeHashSHA1(final String text)