Code Room
Code reviewHardcr-g444
Subject Crypto misuseLevel Senior–Staff~26 minCommon in Security · Distributed systems interviewsIndustries Software development, Technology

Question

Review this Go message encryptor using AES-GCM with a counter nonce.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewgo
var counter uint64 func Encrypt(key, plaintext []byte) ([]byte, error) {	block, _ := aes.NewCipher(key)	gcm, _ := cipher.NewGCM(block)	nonce := make([]byte, gcm.NonceSize())	binary.BigEndian.PutUint64(nonce[4:], counter)	counter++	return gcm.Seal(nil, nonce, plaintext, nil), nil}
Run or narrate your approach, then ask the coach.