If I wanted to create a TOTP-esque algorithm that generated a string
n characters long, with each character being a base64 character, generated from a user secret
r Base64 characters long, every
s seconds, for each of
u number of users, where the probability of collision is very small, how would I calculate the length of the string that was needed?
In case my wording is bad (I'm new to this), here's an example: Say it's generated every 30 seconds from the user's secret, I have 100,000,000 users, the algorithm output is 8 characters long, and the secret for each user is a 32 character Base64 string randomly generated when the user signed up. What would the probability be that two users got the same algorithm output as each other in any one 30s* period? How would I figure out how many characters I would need to make it a one in a million chance?
* Like TOTP, for all users, the 30s period would be the same, i.e. between seconds 0-29 or 30-59 on the clock.