# VF-2000

Source: https://xmlvalid.com/rules/VF-2000

> El cálculo de la huella suministrada es incorrecta (Huella …, calculada …).

- Level: warning
- Rule sets: VERI*FACTU checks of the AEAT Validaciones 1.2.2 (8 April 2026)
- Context: `/*:RegFactuSistemaFacturacion/*:RegistroFactura/*:RegistroAlta[string-length(normalize-space(*:Huella)) = 64]`
- Test: `normalize-space(*:Huella) = $accepted`

> El cálculo de la huella suministrada es incorrecta (Huella …, calculada …).

- Level: warning
- Rule sets: VERI*FACTU checks of the AEAT Validaciones 1.2.2 (8 April 2026)
- Context: `/*:RegFactuSistemaFacturacion/*:RegistroFactura/*:RegistroAnulacion[string-length(normalize-space(*:Huella)) = 64]`
- Test: `normalize-space(*:Huella) = $computed`

In English: The record's fingerprint (Huella) is not the SHA-256, in upper-case hex, of its fields joined as name=value pairs with &: IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura, TipoFactura, CuotaTotal, ImporteTotal, the previous Huella and FechaHoraHusoGenRegistro (the issuer, number, date, previous Huella and time of a cancellation). The record is accepted with errors to correct.

## Why it fails

- A field changed after the fingerprint was computed, often FechaHoraHusoGenRegistro written again when the record was sent.
- The first record of a chain hashed with something after Huella=; it takes nothing there.
- The hex digest written in lower case.

## How to fix it

- Compute the fingerprint last, over the values exactly as the XML carries them without spaces at either end. The AEAT's first example, `IDEmisorFactura=89890001K&NumSerieFactura=12345678/G33&FechaExpedicionFactura=01-01-2024&TipoFactura=F1&CuotaTotal=12.35&ImporteTotal=123.45&Huella=&FechaHoraHusoGenRegistro=2024-01-01T19:20:30+01:00`, gives `3C464DAF61ACB827C65FDA19F352A4E3BDC2C640E9E9FC4CC058073F38F12F60`.

Validate a document against these rules: https://xmlvalid.com/validate
