educative.io

Using base64 encoding, a 6 letters long key would result in 64^6 = ~68.7 billion possible strings

this is written in one content …
Using base64 encoding, a 6 letters long key would result in 64^6 = ~68.7 billion possible strings.

how you will generate 6 letter key using base64 ?
Any java example will be great.

Hi @Parimal_jana, We will use a sequencer to generate six-digit uniques IDs. The internal mechanism of this sequencer might involve a binary (number of bits will depend on your design requirements) to base-64 encoder to convert binary IDs to the base-64. In short, it’s a two-step process: generate unique IDs of a specific number of bits, and convert these unique IDs to the base-64. In the same lesson, the process of this base conversion followed by truncation is explained in detail.
If you’re confused about the possible number of strings, it’s simply a permutation problem. Let’s assume six empty placeholders for the six characters of the short URL. Each empty space can have any character out of the available 64 options. Hence we can compute the total possible strings by using this formula: (Number of available characters to choose from)^total number of characters needed in the string .
For our specific example, it would be (64)^6.