Move crypto functions to own module.