Random Passwords with Go - Part 2
Hello to everyone and welcome back to this second part of Random Passwords with Go. Today we are going yo see how to use all the functions from the previous part, so that we can generate random paswords with a specifict lenght.
Now that we have a function for each different type that compose the password, we can create a function that receives the length of the password and the functions it should use to generate that password.
At this
point in the function if we receive afunction, we will add this function to
an array that we will use late to generate the password.
So, here it’s the
key, we will generate a random number with the length of the array as maximum
and depending on that number, we will call one function or another. With this
method we can generate random password base on what type of password we want.
For example,
we can build one password with 8 characters long, using only numbers and
lowercase letters.
So later in
the code, we can generate a function to manage the password capabilities, for example using a switch.
Hope you enjoy this method of generating random password in Go and I see you in the next post :)
Thank you!!!







Comentarios
Publicar un comentario