basis.crypt refactoring