code: private String getSignature(String str) {
      try {
        MessageDigest md = MessageDigest.getInstance(SHA_STRING);
        md.update(str.getBytes());
        md.update(secretBytes);
        byte[] digest = md.digest();
        return new Base64(0).encodeToString(digest);
      } catch (NoSuchAlgorithmException ex) {
        throw new RuntimeException("Invalid SHA digest String: " + SHA_STRING +
          " " + ex.getMessage(), ex);
      }
    }
docs: Get the signature of the input string based on SHA digest algorithm.
  @param str Input token
  @return Signed String