Skip to content

Commit 08f23ef

Browse files
committed
fix tcp payload hash
1 parent 9e987c2 commit 08f23ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

protocols/tcp/tcp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tcp
33
import (
44
"context"
55
"crypto/rand"
6+
"crypto/sha256"
67
"encoding/hex"
78
"fmt"
89
"log/slog"
@@ -37,9 +38,10 @@ func (s *tcpServer) sendRandom(conn net.Conn) error {
3738
if _, err := rand.Read(randomBytes); err != nil {
3839
return err
3940
}
41+
sum := sha256.Sum256(randomBytes)
4042
s.events = append(s.events, parsedTCP{
4143
Direction: "write",
42-
PayloadHash: hex.EncodeToString(randomBytes),
44+
PayloadHash: hex.EncodeToString(sum[:]),
4345
Payload: randomBytes,
4446
})
4547
if _, err := conn.Write(randomBytes); err != nil {

0 commit comments

Comments
 (0)