Simplify the toBytes helper function a bit

This commit is contained in:
Alexander Bakker 2017-08-07 22:54:23 +02:00
parent ba9d1f7cb6
commit 1f6bceddb7

View file

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