Siret.Net
1.0.0
dotnet add package Siret.Net --version 1.0.0
NuGet\Install-Package Siret.Net -Version 1.0.0
<PackageReference Include="Siret.Net" Version="1.0.0" />
<PackageVersion Include="Siret.Net" Version="1.0.0" />
<PackageReference Include="Siret.Net" />
paket add Siret.Net --version 1.0.0
#r "nuget: Siret.Net, 1.0.0"
#:package Siret.Net@1.0.0
#addin nuget:?package=Siret.Net&version=1.0.0
#tool nuget:?package=Siret.Net&version=1.0.0
Siret.Net
Zero-dependency validation of French business identifiers for .NET: the SIREN (9-digit legal-entity id) and the SIRET (14-digit establishment id), plus the SIREN / NIC relationship between them.
MIT Zero dependencies Native AOT clean
Why
Existing .NET options are either an online API wrapper (a network call to check a checksum) or a large multi-country monolith. Doing it by hand usually gets one case wrong: La Poste. Its SIRETs do not satisfy the Luhn checksum yet are valid, so a plain Luhn check wrongly rejects them.
Install
dotnet add package Siret.Net
Use
using Siret;
bool ok = SiretNumber.IsValid("732 829 320 00074"); // true, spaces/dots/hyphens ignored
SiretNumber siret = SiretNumber.Parse("73282932000074"); // throws FormatException when invalid
string siren = siret.Siren.Value; // "732829320"
string nic = siret.Nic; // "00074"
string text = siret.Format(); // "732 829 320 00074"
if (SirenNumber.TryParse("404833048", out var entity)) { /* entity.Value */ }
Both SirenNumber and SiretNumber offer IsValid, throwing Validate / Parse, and non-throwing TryValidate / TryParse. null makes the Try methods return false; the throwing ones raise ArgumentNullException for null and FormatException for anything else invalid.
Rules
- SIREN: 9 digits, Luhn checksum.
- SIRET: 14 digits. The whole number is checked, and its first 9 digits must themselves be a valid SIREN.
- La Poste exception: a SIRET starting with
356000000(other than the head office35600000000048) is valid when the sum of its digits is divisible by 5, instead of Luhn. The head office still uses Luhn. The La Poste SIREN356000000itself satisfies Luhn. - Separators (space, dot, hyphen) are ignored. Any other non-digit, or a wrong length, is invalid.
Credit
A port of the fr.siren and fr.siret modules of python-stdnum by Arthur de Jong and contributors (LGPL-2.1+). This library is an independent reimplementation of the documented rules and is MIT licensed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 149 | 10/10/2026 |