MCPcopy Index your code
hub / github.com/f0ng/autoDecoder / hexToByteArray

Method hexToByteArray

src/com/autoDecoder/util/codeDecode.java:404–422  ·  view source on GitHub ↗
(String inHex)

Source from the content-addressed store, hash-verified

402
403 //hex 转字节数组
404 public static byte[] hexToByteArray(String inHex){
405 int hexlen = inHex.length();
406 byte[] result;
407 if (hexlen % 2 == 1){
408//奇数
409 hexlen++;
410 result = new byte[(hexlen/2)];
411 inHex="0"+inHex;
412 }else {
413//偶数
414 result = new byte[(hexlen/2)];
415 }
416 int j=0;
417 for (int i = 0; i < hexlen; i+=2){
418 result[j]=hexToByte(inHex.substring(i,i+2));
419 j++;
420 }
421 return result;
422 }
423
424 public static byte hexToByte(String inHex){
425 return (byte)Integer.parseInt(inHex,16);

Callers 2

decryptKeyivmodeMethod · 0.95
encryptKeyivmodeMethod · 0.80

Calls 1

hexToByteMethod · 0.95

Tested by

no test coverage detected