Crypto: Only extract checksum when there's one
Specifically, check that there are enough characters to extract the 4-characters checksum of safe-encoded strings.
The commit also introduces new tests for some parts of the crypto library.
Ping @vbmithr : can you check the changes in code? Note that I still want to tidy up the tests (they are very hackish right now)…