From 32a4874abfbaff8cb4ee2d31fe71bcc3499e52dc Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 27 Nov 2019 20:34:58 +0100 Subject: Reorganize files, implement proper main. --- pyecsca/codegen/simpleserial/simpleserial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pyecsca/codegen/simpleserial') diff --git a/pyecsca/codegen/simpleserial/simpleserial.c b/pyecsca/codegen/simpleserial/simpleserial.c index d15b309..4d73ebb 100644 --- a/pyecsca/codegen/simpleserial/simpleserial.c +++ b/pyecsca/codegen/simpleserial/simpleserial.c @@ -28,10 +28,10 @@ int hex_decode(int len, char* ascii_buf, uint8_t* data_buf) if (len % 2 != 0) return 1; - for(int i = 0; i < len; i+=2) + for(int i = 0; i < len/2; i++) { - char n_hi = ascii_buf[i]; - char n_lo = ascii_buf[i+1]; + char n_hi = ascii_buf[i*2]; + char n_lo = ascii_buf[i*2+1]; if(n_lo >= '0' && n_lo <= '9') data_buf[i] = n_lo - '0'; -- cgit v1.3