refactored crypto