Sha256: f53128e4f4dbd3d83b18e62692c6c570f3cca8be3a5302b92f500e865ea3fbec

Contents?: true

Size: 461 Bytes

Versions: 146

Compression:

Stored size: 461 Bytes

Contents

# stringxor.rb  Richard Kernahan <kernighan_rich@rubyforge.org>

module Crypt
module StringXor
  
  
  def ^(aString)
    a = self.unpack('C'*(self.length))
    b = aString.unpack('C'*(aString.length))
    if (b.length < a.length)
      (a.length - b.length).times { b << 0 }
    end
    xor = ""
    0.upto(a.length-1) { |pos|
      x = a[pos] ^ b[pos]
      xor << x.chr()
    }
    return(xor)
  end
  
  
end
end

class String
  include Crypt::StringXor
end

Version data entries

146 entries across 144 versions & 5 rubygems

Version Path
rhodes-3.1.0.beta.4 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.1.0.beta.3 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.1.0.beta.2 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.1.0.beta.1 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.2 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.2.beta.1 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.8 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.7 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.6 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.5 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.4 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.3 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.1.beta.2 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0.beta.7 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0.beta.6 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0.beta.5 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0.beta.4 lib/extensions/crypt/crypt/stringxor.rb
rhodes-3.0.0.beta.3 lib/extensions/crypt/crypt/stringxor.rb