github.com/imannamdari/v2ray-core/v5@v5.0.5/transport/internet/kcp/cryptreal.go (about) 1 package kcp 2 3 import ( 4 "crypto/aes" 5 "crypto/cipher" 6 "crypto/sha256" 7 8 "github.com/imannamdari/v2ray-core/v5/common" 9 ) 10 11 func NewAEADAESGCMBasedOnSeed(seed string) cipher.AEAD { 12 hashedSeed := sha256.Sum256([]byte(seed)) 13 aesBlock := common.Must2(aes.NewCipher(hashedSeed[:16])).(cipher.Block) 14 return common.Must2(cipher.NewGCM(aesBlock)).(cipher.AEAD) 15 }