diff a/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20KAT.java b/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20KAT.java --- a/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20KAT.java +++ b/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20KAT.java @@ -43,29 +43,26 @@ public class ChaCha20KAT { public static class TestData { public TestData(String name, String keyStr, String nonceStr, int ctr, int dir, String inputStr, String aadStr, String outStr) { testName = Objects.requireNonNull(name); - key = Convert.hexStringToByteArray(Objects.requireNonNull(keyStr)); - nonce = Convert.hexStringToByteArray( - Objects.requireNonNull(nonceStr)); + Hex.Decoder decoder = Hex.decoder(); + key = decoder.decode(Objects.requireNonNull(keyStr)); + nonce = decoder.decode(Objects.requireNonNull(nonceStr)); if ((counter = ctr) < 0) { throw new IllegalArgumentException( "counter must be 0 or greater"); } direction = dir; if ((direction != Cipher.ENCRYPT_MODE) && (direction != Cipher.DECRYPT_MODE)) { throw new IllegalArgumentException( "Direction must be ENCRYPT_MODE or DECRYPT_MODE"); } - input = Convert.hexStringToByteArray( - Objects.requireNonNull(inputStr)); - aad = (aadStr != null) ? - Convert.hexStringToByteArray(aadStr) : null; - expOutput = Convert.hexStringToByteArray( - Objects.requireNonNull(outStr)); + input = decoder.decode(Objects.requireNonNull(inputStr)); + aad = (aadStr != null) ? decoder.decode(aadStr) : null; + expOutput = decoder.decode(Objects.requireNonNull(outStr)); } public final String testName; public final byte[] key; public final byte[] nonce;