chore: cleanup sudoku internal code

This commit is contained in:
wwqgtxx
2025-12-05 08:53:18 +08:00
parent 25041b599e
commit c33d9ad857
5 changed files with 72 additions and 96 deletions

View File

@@ -5,8 +5,8 @@ import (
"fmt"
"github.com/metacubex/mihomo/component/ech"
"github.com/metacubex/mihomo/transport/sudoku"
"github.com/metacubex/mihomo/transport/vless/encryption"
"github.com/saba-futai/sudoku/pkg/crypto"
"github.com/gofrs/uuid/v5"
)
@@ -71,18 +71,12 @@ func Main(args []string) {
fmt.Println("Password: " + passwordBase64)
fmt.Println("Hash32: " + hash32Base64)
case "sudoku-keypair":
// Generate Master Key
pair, err := crypto.GenerateMasterKey()
if err != nil {
panic(err)
}
// Split the master private key to get Available Private Key
availablePrivateKey, err := crypto.SplitPrivateKey(pair.Private)
privateKey, publicKey, err := sudoku.GenKeyPair()
if err != nil {
panic(err)
}
// Output: Available Private Key for client, Master Public Key for server
fmt.Println("PrivateKey: " + availablePrivateKey)
fmt.Println("PublicKey: " + crypto.EncodePoint(pair.Public))
fmt.Println("PrivateKey: " + privateKey)
fmt.Println("PublicKey: " + publicKey)
}
}