All pastes #22233 Raw Edit

Stuff

public text v1 · immutable
#22233 ·published 2005-09-06 16:43 UTC
rendered paste body
class EncryptedString
  attr_accessor :object
  def initialize(object)
    @object = object.to_s
    encrypt_object
  end
  def encrypt_object
    a = []
    for i in 0...@object.length
      a[i] = sprintf("%08b", @object[i])
      a[i].reverse
    end
    for i in 0...a.size
      #temp_arr = []
      #for x in 0...a[i].reverse
        #temp_arr[x] = 2**x*a[i][x]
      #end
      #a[i] = 0
      #for j in 0...temp_arr.size
        #a[i] += temp_arr[j]
      #end
      a[i] = sprintf("%d", a[i])
      @object[i] = a[i].chr
    end
  end
end