nanoid-dictionary

Predefined character sets to be used with Nano ID


License
MIT
Install
pip install nanoid-dictionary==2.4.0

Documentation

Nano ID dictionary

Alphabets and string functions designed to be used with Nano ID.

Installation

pip install nanoid-dictionary

Usage

Available alphabets and functions:

  • alphabet_std
  • human_alphabet
  • lookalikes
  • lowercase
  • numbers
  • prevent_misreadings(unsafe_chars, alphabet)
  • uppercase

prevent_misreadings(unsafe_chars, alphabet) accepts a string and removes all the characters that look similar by default. The function is also case-insensitive.

from nanoid_dictionary import *

alphabet_std   # => _-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
human_alphabet # => _-23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKMNPQRSTUVWXYZ

lookalikes                               # => 1l0o
lowercase                                # => abcdefghijklmnopqrstuvwxyz
numbers                                  # => 0123456789
prevent_misreadings(lookalikes, 'a1l0o') # => a
uppercase                                # => ABCDEFGHIJKLMNOPQRSTUVWXYZ

Thanks to