Added cipher_isHex()

This commit is contained in:
Steve Thomas 2016-01-27 10:53:24 -06:00
parent c01b94fb6a
commit f556390462
1 changed files with 13 additions and 0 deletions

View File

@ -160,6 +160,19 @@ static void cipher_bin2hex(const unsigned char* in, int sz, char *out) {
}
}
static int cipher_isHex(const unsigned char *hex, int sz){
int i;
for(i = 0; i < sz; i++) {
unsigned char c = hex[i];
if ((c < '0' || c > '9') &&
(c < 'A' || c > 'F') &&
(c < 'a' || c > 'f')) {
return 0;
}
}
return 1;
}
/* extensions defined in crypto_impl.c */
typedef struct codec_ctx codec_ctx;