From e9f777d8f7b8b77993f0b88032c33bbef06959c0 Mon Sep 17 00:00:00 2001 From: ishaan Date: Sun, 12 Jul 2026 08:07:47 +0530 Subject: implement headers --- internal/crypto/salt.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'internal/crypto/salt.go') diff --git a/internal/crypto/salt.go b/internal/crypto/salt.go index 5871506..0718010 100644 --- a/internal/crypto/salt.go +++ b/internal/crypto/salt.go @@ -1 +1,24 @@ package crypto + +import ( + "crypto/rand" + "io" +) + +func NewSalt() [16]byte { + salt := [16]byte{} + if _, err := io.ReadFull(rand.Reader, salt[:]); err != nil { + panic("crypto: failed to read salt: " + err.Error()) + } + + return salt +} + +func NewNonce() [12]byte { + nonce := [12]byte{} + if _, err := io.ReadFull(rand.Reader, nonce[:]); err != nil { + panic("crypto: failed to read nonce: " + err.Error()) + } + + return nonce +} -- cgit v1.3