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

fix build issue in aead.go #14

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions aead.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package miscreant
import (
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
)

Expand All @@ -24,7 +25,7 @@ type aead struct {
// Panics if the key size is unsupported or source of randomness fails.
func GenerateKey(length int) []byte {
if length != 32 && length != 64 {
panic("miscreant.GenerateKey: invalid key size: " + string(length))
panic(fmt.Sprintf("miscreant.GenerateKey: invalid key size: %d", length))
}

key := make([]byte, length)
Expand All @@ -40,7 +41,7 @@ func GenerateKey(length int) []byte {
// Panics if the configured nonce size is less than 16-bytes (128-bits)
func GenerateNonce(c cipher.AEAD) []byte {
if c.NonceSize() < minimumRandomNonceSize {
panic("miscreant.GenerateNonce: nonce size is too small: " + string(c.NonceSize()))
panic(fmt.Sprintf("miscreant.GenerateNonce: nonce size is too small: %d", c.NonceSize()))
}

nonce := make([]byte, c.NonceSize())
Expand Down