Fix validation of snakhash parameter

Also rewrote the test case.

Change-Id: Ib57c03fe8522f5cfb637f371423e1f93b331fa3a