Warmup

Network Security Fall 2021
Due


The goals of this assignment are to:

  1. Refresh your network programming skills by implementing a simple network protocol
  2. Build an assignment submission container image

Proof-of-Work Protocol

A statically-linked Linux binary called a01_powd is hosted in Canvas. This binary implements a simple proof-of-work protocol on port 10001/tcp. Using the language of your choice, implement a client for the following 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 of length \(L\), \(N^LX^{64-L}\) is a 64-byte value prefixed by the nonce such that its SHA-256 hash starts with NU in ASCII, and \(M\) is an ASCII message. Your client must print \(M\) as a lowercase hex-encoded string.

Submission Instructions

Please follow these instructions exactly! The grader script will expect that your submission has the following directory structure and command-line interface.

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

$ tree -F a01_pow_client
a01_pow_client
├── Dockerfile
└── src/

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

$ docker run -it --rm ${solution_image} 127.0.0.1

Submit the solution archive to Canvas.