Skip to content

Instantly share code, notes, and snippets.

@SakuraHentai
Last active September 27, 2018 09:55
Show Gist options
  • Save SakuraHentai/1cf539798fb5ff1b32313377f32d23a3 to your computer and use it in GitHub Desktop.
Save SakuraHentai/1cf539798fb5ff1b32313377f32d23a3 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"strconv"
"strings"
)
const pwdLen = 4
func numDecode(char string, pos int) string {
result := ""
pwdRand := "AbCdEfGhIjKlMnOpQrStUvWxYzaBcDeFgHiJkLmNoPqRsTuVwXyZ1234509876-_.\\/:"
charPos := strings.Index(pwdRand, char)
charPos = charPos - (pwdLen + pos - 1)
if charPos <= 0 {
// not found
result = string(pwdRand[charPos+len(pwdRand)-1]) // actionscript index from 1
} else {
result = string(pwdRand[charPos-1]) // actionscript index from 1
}
return result
}
func decode(s string) string {
result := ""
pos := 0
for idx, char := range strings.Split(s, "") {
// actionscript index from 1, so idx + 1
if (idx+1)%(pwdLen+1) != 0 {
result = result + numDecode(char, pos)
continue
}
charCode, err := strconv.Atoi(char)
if err != nil {
pos = 0
} else {
pos = charCode
}
}
return result
}
func main() {
str := "lxxt6jIID2Byq541xEB6F3u71bYaE5A/A-1dMFS4o9mx8uzpm81KxH25u1E29:Cl7Wg|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7_:hQ5Ue|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7_/hQ5Ue|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7_\\hQ5Uelxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7_.hQ5Uelxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7__hQ5Uelxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7_AhQ5Ue|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7bhQW5e|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7ChQW5e|lxxt4hGGB6F3u763zGD9i0X_4EBDh7CAC.6Irkx6q7oz7TYOL2uErB25u1E7dhQW5e"
strArr := strings.Split(str, "|")
for idx, s := range strArr {
strArr[idx] = decode(s)
}
fmt.Println(strings.Join(strArr, "\n"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment