Skip to content

Instantly share code, notes, and snippets.

@leucos
Last active March 23, 2023 17:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leucos/5a44b2ba5c85f6591a39147d618ce104 to your computer and use it in GitHub Desktop.
Save leucos/5a44b2ba5c85f6591a39147d618ce104 to your computer and use it in GitHub Desktop.
Vade Retro Spamcause (X-VR-SPAMCAUSE) Golang decoder
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("usage: spamcause gggruggvucft...")
os.Exit(1)
}
b := []byte(os.Args[1])
res := []byte{}
odd := false
err := false
for i := 0; i < len(b)/2; i++ {
var first, sec byte
if odd {
first, sec = b[2*i : 2*i+1][0], b[2*i+1 : 2*i+2][0]
} else {
sec, first = b[2*i : 2*i+1][0], b[2*i+1 : 2*i+2][0]
}
odd = !odd
if first >= 0x63 && first <= 0x6f {
res = append(res, (first-0x62)*0x11+sec-0x66)
} else {
err = true
res = append(res, 0x3f)
}
if err {
fmt.Printf("got error with record: %x %x\n", first, sec)
}
}
fmt.Printf("%s\n", res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment