Refactored method for crytp password