private static byte[] hash(String text) throws AWSIotException {
  try {
    MessageDigest md=MessageDigest.getInstance(HASH_ALGORITHM);
    md.update(text.getBytes(UTF8));
    return md.digest();
  }
 catch (  Exception e) {
    throw new AWSIotException("Unable to compute hash while signing request: " + e.getMessage());
  }
}

private static byte [ ] hash ( String text ) throws AWSIotException { try { MessageDigest md = MessageDigest . getInstance ( HASH_ALGORITHM ) ; md . update ( text . getBytes ( UTF8 ) ) ; return md . digest ( ) ; } catch ( Exception e ) { throw new AWSIotException ( "Unable to compute hash while signing request: " + e . getMessage ( ) ) ; } }
hashes the string contents ( assumed to be utf - 8 ) using the sha - 256 algorithm .
