From 3a49725b5c3a0f995883f18a6b8d29d84ae53050 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Mon, 27 Feb 2017 19:07:47 -0300 Subject: [PATCH] =?utf8?q?Gera=20hash=20do=20CPF=20no=20cabe=C3=A7alho.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Um dos campos do cabeçalho apresenta um hash que é apenas um CRC32 do CPF. Se uma nova versão do IRPF remover tal campo, basta reverter este commit junto com a provável atualização do campo de versão. --- lib/gera.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/gera.c b/lib/gera.c index bfd1aa1..bd70fdc 100644 --- a/lib/gera.c +++ b/lib/gera.c @@ -127,7 +127,10 @@ static void gera_header(struct declaracao *dec, FILE *f) fprintf(f, "%-11.11s", ""); /* CPF inventariante */ fprintf(f, "%-40.40s", dec->contribuinte.municipio); fprintf(f, "%-60.60s", dec->nome); - fprintf(f, "%-11.11s", ""); /* CPF empregada */ + if (dec->ano == 2017) + fprintf(f, "%010u ", crc32(0, dec->cpf, 11)); /* hash CPF */ + else + fprintf(f, "%-11.11s", ""); /* CPF empregada, FILLER */ fprintf(f, "%-12.12s", sistema_get_mac(dec)); fprintf(f, "%08d", 0); /* Data saída */ fprintf(f, "%-11.11s", ""); /* CPF procurador */ -- 2.20.1