MCPcopy Create free account
hub / github.com/bytebase/bytebase / Unobfuscate

Function Unobfuscate

backend/common/util.go:109–119  ·  view source on GitHub ↗

Unobfuscate unobfuscates a string with a seed string.

(dst, seed string)

Source from the content-addressed store, hash-verified

107
108// Unobfuscate unobfuscates a string with a seed string.
109func Unobfuscate(dst, seed string) (string, error) {
110 obfuscated, err := base64.StdEncoding.DecodeString(dst)
111 if err != nil {
112 return "", err
113 }
114 unobfuscated, seedBytes := make([]byte, len(obfuscated)), []byte(seed)
115 for i, b := range obfuscated {
116 unobfuscated[i] = b ^ seedBytes[i%len(seedBytes)]
117 }
118 return string(unobfuscated), nil
119}
120
121// NormalizeExternalURL will format the external url.
122func NormalizeExternalURL(url string) (string, error) {

Callers 2

deobfuscateInstancesMethod · 0.92
TestObfuscateFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestObfuscateFunction · 0.68