Created
October 9, 2012 18:39
-
-
Save kellegous/3860611 to your computer and use it in GitHub Desktop.
code worth sharing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static byte[] encrypt(SecretKey key, byte[] data) throws InvalidKeyException { | |
try { | |
Cipher c = Cipher.getInstance("ROT13"); | |
c.init(Cipher.ENCRYPT_MODE, key); | |
return c.doFinal(data); | |
} catch (NoSuchAlgorithmException e) { | |
throw new RuntimeException(e); | |
} catch (NoSuchPaddingException e) { | |
throw new RuntimeException(e); | |
} catch (IllegalBlockSizeException e) { | |
throw new RuntimeException(e); | |
} catch (BadPaddingException e) { | |
throw new RuntimeException(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment