diff options
Diffstat (limited to 'ssha.go')
-rw-r--r-- | ssha.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,11 +1,12 @@ package main import ( + "log" "bytes" "crypto/sha1" "encoding/base64" "fmt" - "math/rand" + "crypto/rand" ) // Encode encodes the []byte of raw password @@ -38,7 +39,10 @@ func SSHAMatches(encodedPassPhrase string, rawPassPhrase []byte) bool { // makeSalt make a 32 byte array containing random bytes. func makeSalt() []byte { sbytes := make([]byte, 32) - rand.Read(sbytes) + _, err := rand.Read(sbytes) + if err != nil { + log.Panicf("Could not read random bytes: %s", err) + } return sbytes } |