github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/secret/password.go (about) 1 package secret 2 3 import ( 4 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring" 5 ) 6 7 func Password(password string) string { 8 var ( 9 bytes = []byte(password) 10 startPosition = 3 11 endPosition = len(bytes) - 2 12 ) 13 if startPosition > endPosition { 14 for i := range bytes { 15 bytes[i] = '*' 16 } 17 } else { 18 for i := startPosition; i < endPosition; i++ { 19 bytes[i] = '*' 20 } 21 } 22 23 return xstring.FromBytes(bytes) 24 }