A Simple Protocol

Submission Deadline:

The goals of this assignment are to:

  1. Implement a simple network protocol
  2. Build a solution container image

Proof-of-Work Protocol

The image at gcr.io/netsec-2020-fall/00-powd:latest contains a server that implements a simple proof-of-work protocol on port 11111/tcp. Using the language of your choice, implement a client for the protocol

\[ \begin{align*} S \rightarrow C &: L \\ S \rightarrow C &: N^L \\ C \rightarrow S &: N^LX^{64-L} \\ S \rightarrow C &: M \\ \end{align*} \]

where \(L\) is a two-byte big-endian length, \(N^L\) is a nonce, \(N^LX^{64-L}\) is a 64-byte value prefixed by the nonce such that its SHA-256 hash starts with ns in ASCII, and \(M\) is an ASCII message. Your client must print \(M\).

When writing your client, you should anticipate and handle behavioral variances due to, e.g., network congestion or different protocol implementations. You can run the reference server such that it is reachable at like so:

$ podman run -it --rm -e RUST_LOG=info -p 11111:11111 gcr.io/netsec-2020-fall/00-powd:latest

Submission Instructions

Package your solution as a gzipped TAR archive. Your solution should expand to the following:

$ tree -F 00-pow_client
├── Containerfile
└── src/

The source code to your solution should be contained in src/. Your Containerfile should, when processed using docker or buildah, create an image that runs your solution against a powd server. For instance, if the powd server is running on, then your image must successfully run with:

$ podman run -it --rm ${solution_image}

Submit the solution archive to Canvas.