[feature/crypto] Make sure hash has the required length

Also added tests to make sure that crypto drivers are enforcing the hash
length.

PHPBB3-11610