lundi 27 juillet 2020

How do you convert crypto.randomBytes to custom alphabet? [duplicate]

I would like to generate a 40-character long string using only 0-9, how can I do that while also using crypto.randomBytes(x)? And what should x be, I'm not sure the relation between the bytes and the alphabet (which is only 10 characters, not 256). Is there a general formula for this?




Aucun commentaire:

Enregistrer un commentaire