recsha: Add robustness checks

Signed-off-by: Michael Buesch <m@bues.ch>