Use SHA3-256 instead of SHA2-256; Support XTLS Vision for random appearance

https://github.com/XTLS/Xray-core/pull/4952#issuecomment-3197163816
This commit is contained in:
RPRX
2025-08-18 14:58:21 +00:00
committed by GitHub
parent d1fb485212
commit 49580705f6
8 changed files with 129 additions and 74 deletions

View File

@@ -5,7 +5,7 @@ import (
"crypto/cipher"
"crypto/mlkem"
"crypto/rand"
"crypto/sha256"
"crypto/sha3"
"io"
"net"
"strings"
@@ -58,10 +58,10 @@ func (i *ClientInstance) Init(nfsEKeyBytes []byte, xor uint32, minutes time.Dura
if err != nil {
return
}
hash256 := sha256.Sum256(nfsEKeyBytes)
hash256 := sha3.Sum256(nfsEKeyBytes)
copy(i.hash11[:], hash256[:])
if xor > 0 {
xorKey := sha256.Sum256(nfsEKeyBytes)
xorKey := sha3.Sum256(nfsEKeyBytes)
i.xorKey = xorKey[:]
}
i.minutes = minutes