From: Colin Patrick McCabe Date: Sat, 14 Aug 2010 23:10:33 +0000 (-0700) Subject: Add silly-encoder.rb X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67755ca38c9e017356ee447865b64d28e4e51ae7;p=cmccabe-bin Add silly-encoder.rb --- diff --git a/silly-encoder.rb b/silly-encoder.rb new file mode 100755 index 0000000..5837889 --- /dev/null +++ b/silly-encoder.rb @@ -0,0 +1,46 @@ +#!/usr/bin/ruby + +# +# Silly single letter-for-glyph substitution cipher. +# Tested with ruby 1.8 +# +# Colin McCabe +# + +ctable = { + 97 => '☏', + 98 => '✄', + 99 => '❶', + 100 => '⑧', + 101 => '✡', + 102 => '☾', + 103 => '✠', + 104 => '⚐', + 105 => '⦿', + 106 => '☯', + 107 => '◈', + 108 => '⬟', + 109 => '✈', + 110 => '♈', + 111 => '⁂', + 112 => '※', + 113 => '¢', + 114 => '®', + 115 => '⍓', + 116 => '¶', + 117 => '»', + 118 => 'Ñ', + 119 => '§', + 120 => '∑', + 121 => '☺', + 122 => '☹', + 123 => '☠' +} + +STDIN.read.each_byte do |c| + if ctable.has_key?(c) + printf ctable[c] + else + printf c.chr + end +end