private static byte[] encrypt(String algorithm, byte[] key, byte[] data) {
BlockCipher cipher = CipherFactory.getBlockCipher(algorithm);
byte[] newKey = getPaddedArrayCopy(key, cipher.getKeyLength());
cipher.setKey(newKey);
byte[] newData = getPaddedArrayCopy(data, BlockCipher.ALIGN);
cipher.encrypt(newData, 0, newData.length);
return newData;
}
private static byte[] getHash(String algorithm, byte[] bytes, int iterations) {
if (!"SHA256".equalsIgnoreCase(algorithm)) {