code: public static String digestSha1Hex(String source) {
          String sha1 = "";
          try {
              MessageDigest crypt = MessageDigest.getInstance("SHA-1");
              crypt.reset();
              crypt.update(source.getBytes("UTF-8"));
              sha1 = byteToHex(crypt.digest());
          } catch (NoSuchAlgorithmException e) {
              e.printStackTrace();
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          }
          return sha1;
      }
docs: Hashes the source with SHA1 and returns the resulting hash as an hexadecimal string.
  
  @param source the text to hash.
  @return the SHA1 hash of the source, in hexadecimal form.