add gen X25519 private key

This commit is contained in:
Yuzuki616
2023-07-15 19:37:44 +08:00
parent 97a420f9f3
commit 098f4fd2bf
7 changed files with 89 additions and 118 deletions

13
common/crypt/x25519.go Normal file
View File

@@ -0,0 +1,13 @@
package crypt
import (
"crypto/sha256"
)
func GenX25519Private(data []byte) []byte {
key := sha256.Sum256(data)
key[0] &= 248
key[31] &= 127
key[31] |= 64
return key[:32]
}