Move crypto functions that the lua scripts call into a package

Ref #14