Code cleanup and test cases for authentication digest