8000 Added cipher_isHex() · magic-coder/sqlcipher@f556390 · GitHub
[go: up one dir, main page]

Skip to content

Commit f556390

Browse files
committed
Added cipher_isHex()
1 parent c01b94f commit f556390

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/crypto.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ static void cipher_bin2hex(const unsigned char* in, int sz, char *out) {
160160
}
161161
}
162162

163+
static int cipher_isHex(const unsigned char *hex, int sz){
164+
int i;
165+
for(i = 0; i < sz; i++) {
166+
unsigned char c = hex[i];
167+
if ((c < '0' || c > '9') &&
168+
(c < 'A' || c > 'F') &&
169+
(c < 'a' || c > 'f')) {
170+
return 0;
171+
}
172+
}
173+
return 1;
174+
}
175+
163176
/* extensions defined in crypto_impl.c */
164177
typedef struct codec_ctx codec_ctx;
165178

0 commit comments

Comments
 (0)
0