bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.66k stars 495 forks source link

Fix incorrect generation for Finnish social security number #427

Closed roeyskoe closed 8 months ago

roeyskoe commented 2 years ago

There were three issues with calculating control character for Finnish personal identity code (henkilötunnus).

  1. Three-digit part after birthdate was not taken into account when calculating it.
  2. Invalid characters were not skipped.
  3. Gender was ignored.

It was also (rarely) possible to get 000 or 001 as the number part, both of which invalid.

This also changes that the number part is always between 002-899. Numbers 900-999 do not exist "in the wild", they are strictly reserved for temporary identity codes. There could of course be an option to also allow temporary codes, or generate only them. I can add them if you wish.

How the identity code is formed: https://dvv.fi/en/personal-identity-code

Fixes #392

bchavez commented 8 months ago

Hello. Thank you for the pull request.

Your changes are published in Bogus v35.4.0:

Thanks again for the help. -Brian