X-Git-Url: https://git.llucax.com/z.facultad/66.09/etherled.git/blobdiff_plain/9754cd3d910c27852ade14360c701038b767fe8a..0052faf6d85ec776823a1a33efc8d911b4b4e2f6:/pruebas/c/checksum.c diff --git a/pruebas/c/checksum.c b/pruebas/c/checksum.c index bc2b6d3..08b8655 100644 --- a/pruebas/c/checksum.c +++ b/pruebas/c/checksum.c @@ -49,12 +49,16 @@ int main(int argc, char* argv[]) { u16 buf[256]; u8 len; + u16 sum; if (argc < 2) { fprintf(stderr, "Uso: %s string_hexa_con_tamaƱo_multiplo_de_4\n", argv[0]); return 1; } len = strtou16(argv[1], strlen(argv[1]), buf); + sum = chksum(buf, len); + printf("%hX\n", sum); + buf[len++] = sum; printf("%hX\n", chksum(buf, len)); return 0; }