This commit is contained in:
jdl
2025-09-03 20:41:35 +02:00
parent 0a7328ed5f
commit c61319ed16
3 changed files with 6 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
package peer
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
@@ -38,6 +39,10 @@ func (sc *dataCipher) Key() [32]byte {
return sc.key
}
func (sc *dataCipher) HasKey(k [32]byte) bool {
return bytes.Equal(k[:], sc.key[:])
}
func (sc *dataCipher) Encrypt(h Header, data, out []byte) []byte {
const s = dataHeaderSize
out = out[:s+dataCipherOverhead+len(data)]