github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/transport/internet/kcp/cryptreal.go (about)

     1  package kcp
     2  
     3  import (
     4  	"crypto/aes"
     5  	"crypto/cipher"
     6  	"crypto/sha256"
     7  	"v2ray.com/core/common"
     8  )
     9  
    10  func NewAEADAESGCMBasedOnSeed(seed string) cipher.AEAD {
    11  	HashedSeed := sha256.Sum256([]byte(seed))
    12  	aesBlock := common.Must2(aes.NewCipher(HashedSeed[:16])).(cipher.Block)
    13  	return common.Must2(cipher.NewGCM(aesBlock)).(cipher.AEAD)
    14  }