Compute M2 for server authenticity check
minor cleanups
Merge PR 25: compute/check M2