Some fixes;
Added Crypto digest tests;
Some optimizations.