Compare commits
No commits in common. "e4eca321f6d1b883a8a2402753a0a47af1c51f4b" and "710f96e9e763873234577f72d792add32826b9ff" have entirely different histories.
e4eca321f6
...
710f96e9e7
10
main.go
10
main.go
@ -1,13 +1,12 @@
|
||||
// GoPass
|
||||
// Author: Maximilian Patterson
|
||||
// Version: 1.2.2
|
||||
// Version: 1.2.1
|
||||
package main
|
||||
|
||||
import (
|
||||
cryptorand "crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/big"
|
||||
mathrand "math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -61,12 +60,7 @@ func main() {
|
||||
// Assign every slot of pass to a random allowedCharacter
|
||||
for i := range pass {
|
||||
// Generate a random int greater than 0 and not to exceed the length of allowedCharacters
|
||||
index, err := cryptorand.Int(cryptorand.Reader, big.NewInt(int64(len(allowedCharacters))))
|
||||
if err != nil {
|
||||
println("Error securely generating random character!")
|
||||
return
|
||||
}
|
||||
pass[i] = allowedCharacters[index.Int64()]
|
||||
pass[i] = allowedCharacters[mathrand.Intn(len(allowedCharacters))]
|
||||
}
|
||||
|
||||
// Print the password
|
||||
|
Loading…
Reference in New Issue
Block a user