added tests for digest encode and decode