Refactored Crypto.java