Skip to content

Instantly share code, notes, and snippets.

@wattanakorn495
Last active April 27, 2024 10:52
Show Gist options
  • Save wattanakorn495/6d9a72e3e2ec9d228dc57ac64a75fb02 to your computer and use it in GitHub Desktop.
Save wattanakorn495/6d9a72e3e2ec9d228dc57ac64a75fb02 to your computer and use it in GitHub Desktop.
Decode
package main
import (
"encoding/base64"
"fmt"
"strings"
)
// function, which takes a string as
// argument and return the reverse of string.
func reverse(s string) string {
rns := []rune(s) // convert to rune
for i, j := 0, len(rns)-1; i < j; i, j = i+1, j-1 {
// swap the letters of the string,
// like first with last and so on.
rns[i], rns[j] = rns[j], rns[i]
}
// return the reversed string.
return string(rns)
}
func main() {
inputStr := "YOUR_INPUT"
reveredStr := reverse(inputStr)
fmt.Println(reveredStr)
b, err := base64.StdEncoding.WithPadding(base64.NoPadding).DecodeString(reveredStr)
if err != nil {
fmt.Println(err)
}
fmt.Println("b: ", string(b))
splited := strings.Split(string(b), ":")
fmt.Println("UUID:", splited[0])
fmt.Println("Username: ", splited[1])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment