Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
fix: handle io.ReadFull error
Browse files Browse the repository at this point in the history
  • Loading branch information
tarithj committed Dec 2, 2020
1 parent 1464fbe commit d63e0ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func encrypt(data []byte, p passphrase, channel chan encryptedData, wg *sync.Wai
block, _ := aes.NewCipher([]byte(createHash(string(p))))
gcm, _ := cipher.NewGCM(block)
nonce := make([]byte, gcm.NonceSize())
_, _ = io.ReadFull(rand.Reader, nonce)
_, err := io.ReadFull(rand.Reader, nonce)
if err != nil {
log.Fatalln(err)
}
cipherText := gcm.Seal(nonce, nonce, data, nil)
channel <- cipherText
}
Expand Down

0 comments on commit d63e0ae

Please sign in to comment.