Ruby (<strike>200</strike> 185) ==== sample runs + wc: $ ruby onetimepad.rb ENCODE ANOTHERTESTINPUTZZZ ZYCLGHDWLDASFUTHWKC BPMIBXOXTPTQIVBMDPX $ ruby onetimepad.rb DECODE ZYCLGHDWLDASFUTHWKC BPMIBXOXTPTQIVBMDPX ANOTHERTESTINPUTZZZ $ wc onetimepad.rb 4 7 185 onetimepad.rb <!-- language-all: lang-rb --> def f;gets.scan(/./).map{|b|b.ord-65};end s=->a{a.map{|b|(b+65).chr}*''} r=->b,a,o{s[a.zip(b).map{|a,b|(a.send o,b)%26}]} puts(gets=~/^D/?r[f,f,:+]:[s[k=(p=f).map{rand 26}],r[k,p,:-]])