mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
add gen X25519 private key
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
package crypt
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func GenShaHash(data []byte) string {
|
||||
d := sha256.Sum256(data)
|
||||
return hex.EncodeToString(d[:])
|
||||
}
|
||||
13
common/crypt/x25519.go
Normal file
13
common/crypt/x25519.go
Normal 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]
|
||||
}
|
||||
Reference in New Issue
Block a user