August 2019
Beginner to intermediate
798 pages
17h 2m
English
Once you know how a computer represents single characters, it is not difficult to go from pseudo-random numbers to random strings. This section will present a technique for creating difficult-to-guess passwords based on the Go code of randomNumbers.go, which was presented in the previous section. The name of the Go program for this task will be generatePassword.go, and it is going to be presented in four parts. The utility requires just one command-line parameter, which is the length of the password that you want to generate.
The first part of generatePassword.go contains the following Go code:
package main import ( "fmt" "math/rand" "os" "strconv" "time" ) func random(min, max int) int { return rand.Intn(max-min) ...Read now
Unlock full access