cryptreal.go 247 B

12345678910111213
  1. package kcp
  2. import (
  3. "crypto/cipher"
  4. "crypto/sha256"
  5. "github.com/xtls/xray-core/common/crypto"
  6. )
  7. func NewAEADAESGCMBasedOnSeed(seed string) cipher.AEAD {
  8. hashedSeed := sha256.Sum256([]byte(seed))
  9. return crypto.NewAesGcm(hashedSeed[:16])
  10. }