Skip to content

Instantly share code, notes, and snippets.

@gerow
Created July 31, 2013 19:39
Show Gist options
  • Save gerow/6125425 to your computer and use it in GitHub Desktop.
Save gerow/6125425 to your computer and use it in GitHub Desktop.
Convert a hex string into a semipronouncable string of characters
#!/usr/bin/ruby
string = ARGV[0]
puts string.downcase.split("").map{|e|
case e
when "0"
"ka"
when "1"
"tsu"
when "2"
"shi"
when "3"
"ha"
when "4"
"ko"
when "5"
"ma"
when "6"
"ku"
when "7"
"su"
when "8"
"so"
when "9"
"mu"
when "a"
"mo"
when "b"
"ya"
when "c"
"yu"
when "d"
"ki"
when "e"
"fu"
when "f"
"ni"
else
"INVAL"
end
}.each_slice(2).to_a.map{|e| e.join}.join(" ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment