Module: CTF::Utils::StringWithXor
- Included in:
- String
- Defined in:
- lib/ctf/utils.rb
Instance Method Summary collapse
Instance Method Details
#^(s) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/ctf/utils.rb', line 4 def ^(s) if s.is_a?(String) chars.zip(s[0, length].chars).map{|a,b| b ? (a.ord ^ b.ord).chr : a }.join else s = s.to_i chars.map{|a|(a.ord^s).chr}.join end end |