NIF is a .NET 6 library to validate the Spanish NIF. This library allows to validate the DNI, NIE and CIF. It also allows to generate random DNI, NIE and CIF.
bool result = NifValidator.Validate("32700667A");
String dni = NifGenerator.GenerateDNI();