Move all cryptographic functions into their own module

This simplifies the cookie session implementation and also #426 and hhucn/adhocracy.hhu_theme#341 .