code: private String calculateSHA256Hash(byte[] msg, int offset, int len) {
  		// Calculate the SHA256 digest of the Hello message
  		Digest digest = platform.getCrypto().createDigestSHA256();
  		digest.update(msg, offset, len);
  		int digestLen = digest.getDigestLength();
  		// prepare space for hexadecimal representation, store the diggest in
  		// the second half and then convert
  		byte[] hash = new byte[2 * digestLen];
  		digest.getDigest(hash, digestLen, true);
  		for (int i = 0; i != digestLen; ++i) {
  			byte b = hash[digestLen + i];
  			int d1 = (b >> 4) & 0x0f;
  			int d2 = b & 0x0f;
  			hash[i * 2] = (byte) ((d1 >= 10) ? d1 + 'a' - 10 : d1 + '0');
  			hash[i * 2 + 1] = (byte) ((d2 >= 10) ? d2 + 'a' - 10 : d2 + '0');
  		}
  		String hashStr = new String(hash);
  		if (platform.getLogger().isEnabled()) {
  			logBuffer("calculateSHA256Hash", msg, offset, len);
  			logString("SHA256 Hash = '" + hashStr + "'");
  		}
  		return hashStr;
  	}
docs: Calculate the hash digest of part of a message using the SHA256 algorithm
  
  @param msg
  Contents of the message
  @param offset
  Offset of the data for the hash
  @param len
  Length of msg to be considered for calculating the hash
  @return String of the hash in base 16