我找到了一个使用此功能的 ruby 加密库。
def process(text)
0.upto(text.length-1) {|i| text[i] = text[i] ^ round}
text
end
在 ruby 1.9.x 中它会抛出一个错误 -undefined method ^' for "\x1A":String__
ruby 1.9.x 有什么解决方法吗?
谷歌搜索后,我知道“在 Ruby 1.9 中,字符串 [index] 返回字符而不是字符的代码(就像在 1.8 中一样)。 ”(https://rails.lighthouseapp.com/projects/8994/tickets/3144- undefined-method-for-string-ror-234)
提前致谢