Simplify the toBytes helper function a bit

pull/41/head
Alexander Bakker 8 years ago
parent ba9d1f7cb6
commit 1f6bceddb7

@ -118,8 +118,6 @@ public class CryptoUtils {
private static byte[] toBytes(char[] chars) { private static byte[] toBytes(char[] chars) {
CharBuffer charBuf = CharBuffer.wrap(chars); CharBuffer charBuf = CharBuffer.wrap(chars);
ByteBuffer byteBuf = Charset.forName("UTF-8").encode(charBuf); ByteBuffer byteBuf = Charset.forName("UTF-8").encode(charBuf);
byte[] bytes = Arrays.copyOfRange(byteBuf.array(), 0, byteBuf.limit()); return byteBuf.array();
zero(byteBuf.array());
return bytes;
} }
} }

Loading…
Cancel
Save