Skip to content

Instantly share code, notes, and snippets.

@in1yan
Created March 14, 2025 05:33
Show Gist options
  • Save in1yan/6db6a85808e56a3bc12edf75daafe88d to your computer and use it in GitHub Desktop.
Save in1yan/6db6a85808e56a3bc12edf75daafe88d to your computer and use it in GitHub Desktop.
sloth bytes
package main
import (
"fmt"
)
var hash = map[rune]string{
'1':"I",
'2':"Z",
'3':"E",
'4':"H",
'5':"S",
'6':"G",
'7':"L",
'8':"B",
'9':"",
'0':"O",
}
func main(){
fmt.Println(turnCalc("707"))
fmt.Println(turnCalc("5508"))
fmt.Println(turnCalc("3045"))
fmt.Println(turnCalc("07734")) // treats the leading zero as octal so used strings instead of integers
}
func turnCalc(msg string) string{
res := ""
for i := len(msg)-1; i>=0; i--{
res += hash[rune(msg[i])]
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment