Refactor range function to check whether the provided password is properly encrypted or needed to be encrypted. VAN-789