Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 14, 2024
1 parent 1485800 commit e84da92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hopper.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (l *Listener) Close() error {
func decryptPacket(crypter BlockCrypt, packet []byte) (data []byte, err error) {
if crypter != nil && len(packet) >= headerSize {
crypter.Decrypt(packet, packet)
// use the first 8 byte of md5 digest as the checksum
// use the first 8 bytes of md5 digest as the checksum
checksum := md5.Sum(packet[headerSize:])
if !bytes.Equal(checksum[:checksumSize], packet[checksumOffset:checksumOffset+checksumSize]) {
return nil, errChecksum
Expand All @@ -334,7 +334,7 @@ func encryptPacket(crypter BlockCrypt, data []byte) (packet []byte) {
if crypter != nil {
packet = make([]byte, len(data)+headerSize)
copy(packet[headerSize:], data)
// fill the nonce(12 bytes)
// fill the nonce(8 bytes)
_, _ = io.ReadFull(rand.Reader, packet[nonceOffset:nonceOffset+nonceSize])
// fill in half MD5(8 bytes)
checksum := md5.Sum(packet[headerSize:])
Expand Down

0 comments on commit e84da92

Please sign in to comment.