refactored crypto stuf into corresponding class