Cryptography guides

Keep leading zeroes when issuing fixed-width PINs

·

An access system can require a six-character decimal code even when its first digit is zero. Treat codes as fixed-width text when you copy, import or compare them.

PIN Generator

Check the width of a six-digit batch

Set Digits per PIN to 6, set PIN count to 20 and choose Generate PINs. Reveal the results. There are 20 lines of six decimal characters, whatever each line’s first digit happens to be.

Copy PINs into a plain-text editor or a spreadsheet column configured as text. The example below represents one possible six-digit code. Keep both leading zeroes when moving it between applications.

A synthetic six-character PIN
004731

Web Cryptography API random values

Decide whether to remove patterned codes

Turn on Skip repeated blocks and straight sequences, then generate again. The generator rejects a candidate such as 123456 or 424242 and draws a new one. A zero can occur anywhere in an accepted result.

The unfiltered six-digit space has 1,000,000 values. Filtering removes some of those values. For an access system, also confirm the allowed length and the verifier’s attempt limits.

Web Cryptography API random valuesNIST SP 800-63B-4, rate limiting

Common questions

Why did a spreadsheet drop my first digit?

It probably parsed the code as a number and dropped leading zeroes. Configure the column as text before importing the original copied values.

Why can two generated lines have the same PIN?

Each line is an independent draw from the allowed values. If your access system requires a unique batch, verify uniqueness before registering those values.

Sources

Put it into practice.

Related guides