Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/openid/util.rb

Overview

class DateTime

Instance Method Summary collapse

Instance Method Details

#^(other) ⇒ Object

Raises an ArgumentError if strings are different length.

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
76
# File 'lib/openid/util.rb', line 69

def ^(other)
	raise ArgumentError, "Can't bitwise-XOR a String with a non-String" \
		unless other.kind_of? String
	raise ArgumentError, "Can't bitwise-XOR strings of different length" \
		unless self.length == other.length
	result = (0..self.length-1).collect { |i| self[i] ^ other[i] }
	result.pack("C*")\
end