Code Room
Code reviewHard
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.
Learn the concepts
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.