Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created July 17, 2011 04:40
Show Gist options
  • Select an option

  • Save chanwit/1087189 to your computer and use it in GitHub Desktop.

Select an option

Save chanwit/1087189 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "os"
var scores=map[string]string{
"qd__f_ee": "`b]__",
"qd_``baa": "_e]__",
"qd_`abah": "`d]__",
"qd_adcfb": "_e]d_",
"qd`_`dca": "`_]d_",
"qd```ahh": "`a]__",
"qd`acg`f": "`b]d_",
"qd`acgge": "`f]d_",
"qd`ad_cb": "`b]__",
"qd`aff_a": "`c]__",
"qd`badbh": "`g]d_",
"qda``gfe": "`d]__",
"qda`b_gd": "`b]__",
"qdaaahec": "`a]d_"}
func rot47(id string) string {
result := make([]byte, len(id))
bytes := []byte(id)
for i:=0; i<len(bytes); i++ {
result[i] = bytes[i]+47
if result[i] > 126 {
result[i] = result[i] - 94
}
if result[i] < 33 {
result[i] = result[i] + 94
}
}
return string(result)
}
func main() {
id := rot47(os.Args[1])
fmt.Printf("%s %s\n", os.Args[1], rot47(scores[id]))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment