ai / nanoid

A tiny (124 bytes), secure, URL-friendly, unique string ID generator for JavaScript

Home Page:https://zelark.github.io/nano-id-cc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Technical question] 25 or 26 characters for base32 encoding?

slimhk45 opened this issue · comments

Hi, I need base32 uuid to encode hex uuid in filenames with fewer characters.
But I'm confused: 128/5=25.6. Should I use 25 or 26 characters? Similarly, nanoid choose 21 characters over 22 (128/6=21.3). Why this choice?

Also a last question, what is the advantage of the base32hex (0-9, A-V) over the base32 (A-Z, 2-7) in this case (filename uuid)?

Thanks.

You need to choose bigger number to have not-less bit amount.

Also a last question, what is the advantage of the base32hex (0-9, A-V) over the base32 (A-Z, 2-7) in this case (filename uuid)?

Sorry, don’t know.

But why nanoid chose less then? That's what I don't understand, you have rounded to 21, you should do it to 22 characters then?

Sorry, it is mobilization happening in my country. I don’t have resources to remember the math.