I have the following error in compiling tests and I would like to help me solve it:
String nonce2 = "11111";
String api_key = "271e6189-c251-4067-ab55";
String api_secret = "c9f98b81-e825-4588-b095";
String algorithm = "HmacSHA256";
byte[] keyBytes = Hex.decodeHex((api_key+nonce2).toCharArray());
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(secretKeySpec);
byte[] macBytes = mac.doFinal(api_secret.getBytes());
String hexBytes = new String(Hex.encodeHex(macBytes));
System.out.println(hexBytes);
And send me the error of the title
org.apache.commons.codec.DecoderException: Odd number of characters.
What should I do to improve it?
This is my StackTrace
org.apache.commons.codec.DecoderException: Odd number of characters. at org.apache.commons.codec.binary.Hex.decodeHex (Hex.java:59) at com.alodiga.transferto.integration.connection.RequestManager.testNauta (RequestMa nager.java:297) at transfertotopupintegration.Main.main (Main.java:29)