New CHAP implementation, rewritten from scratch to avoid the code