class String

Public Instance Methods

^(str) click to toggle source

XOR two strings @str assumed to be a one byte string or integer

# File lib/micro_aeth-ae51.rb, line 15
def ^ str
  if str.class == String
    str = str.byte
  elsif str.class == Fixnum
    nil
  else
    raise "invalid arg: #{str.class} \n Must be String or Fixnum"
  end
  self.bytes.each do |i|
    str = str ^ i
  end
  str.chr.force_encoding( "ASCII-8BIT")
end
byte() click to toggle source

@return the first charater in the string as an integer

# File lib/micro_aeth-ae51.rb, line 8
def byte
  self.bytes[0]
end