Unobfuscate unobfuscates a string with a seed string.
(dst, seed string)
| 107 | |
| 108 | // Unobfuscate unobfuscates a string with a seed string. |
| 109 | func 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. |
| 122 | func NormalizeExternalURL(url string) (string, error) { |
no outgoing calls