truncate authentication digest correctly