code: public static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3) throws WsDigestException, NoSuchAlgorithmException {
          MessageDigest md5 = MessageDigest.getInstance("MD5");
  
          ByteBuffer buf = ByteBuffer.allocate(DIGEST_LENGTH);
  
          buf.putInt(parseIntKey(key1));
          buf.putInt(parseIntKey(key2));
  
          // key3 must be exactly 8 bytes
          if (key3.remaining() != 8) {
              throw new WsDigestException("WebSocket key3 must be exactly 8 bytes");
          }
  
          buf.put(key3);
  
          buf.flip();
          byte[] input = new byte[DIGEST_LENGTH];
          buf.get(input, 0, DIGEST_LENGTH);
          byte[] digest = md5.digest(input);
  
          return ByteBuffer.wrap(digest);
      }
docs: /*
  Compute the MD5 sum of the three WebSocket keys
  (draft Hixie-76)
  
  @param key1    Sec-WebSocket-Key1 value
  @param key2    Sec-WebSocket-Key2 value
  @param key3    8 bytes immediately following WebSocket upgrade request
  @return
  @throws NoSuchAlgorithmException