From 45099f6056d2b721ab42ce19bffc0765c011a918 Mon Sep 17 00:00:00 2001 From: yuzuki999 Date: Mon, 7 Aug 2023 10:00:36 +0800 Subject: [PATCH] fix random pw strength --- core/sing/node.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/sing/node.go b/core/sing/node.go index 2a64f42..e6f202f 100644 --- a/core/sing/node.go +++ b/core/sing/node.go @@ -4,7 +4,6 @@ import ( "context" "crypto/rand" "encoding/base64" - "encoding/hex" "fmt" "net/netip" "net/url" @@ -106,7 +105,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio case "2022-blake3-aes-256-gcm": keyLength = 32 default: - keyLength = 8 + keyLength = 16 } in.ShadowsocksOptions = option.ShadowsocksInboundOptions{ ListenOptions: listen, @@ -114,7 +113,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio } p := make([]byte, keyLength) _, _ = rand.Read(p) - randomPasswd := hex.EncodeToString(p) + randomPasswd := string(p) if strings.Contains(info.Cipher, "2022") { in.ShadowsocksOptions.Password = info.ServerKey randomPasswd = base64.StdEncoding.EncodeToString([]byte(randomPasswd))