Levelization: source code structure

This de-tangles dependencies:
* basics/ no longer depends on any other modules
* crypto/ depends only on basics/
* protocol/ depends only on basics/ and crypto/

Reviewers: @scottschurr @mtrippled 
Could we replace the c-style cast with a call to `root.data()`?