Java SHA1 sha1(final String text)

Here you can find the source of sha1(final String text)

Description

sha

License

Apache License

Declaration

public static String sha1(final String text) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.security.MessageDigest;

public class Main {
    public static String sha1(final String text) {

        try {/* w ww.ja  va  2s. com*/
            final byte[] bytesOfMessage = text.getBytes("UTF-8");
            final MessageDigest md = MessageDigest.getInstance("SHA1");
            final byte[] digest = md.digest(bytesOfMessage);

            return new String(digest);
        } catch (Exception e) {
            throw new RuntimeException();
        }
    }
}

Related

  1. sha1(final byte[] bytes)
  2. sha1(final File file)
  3. sha1(final String data)
  4. sha1(final String str)
  5. sha1(final String string)
  6. SHA1(final String text)
  7. sha1(final String todigest)
  8. SHA1(InputStream in)
  9. SHA1(MessageDigest messageDigest, String... texts)