Displaying 1 result from an estimated 1 matches for "hex_decod".
Did you mean:
hex_decode
2006 Mar 03
0
binary_to_string/string_to_binary confusion
...cause it attempts to insert raw
binary into the database.
If I implement them as follows:
def self.hex_encode(value)
retvalue = ""
value.each_byte do |b|
retvalue << sprintf("%02X", b)
end
retvalue
end
def self.hex_decode(value)
retvalue = ""
value.scan(/../) do |h|
c = h.hex
retvalue << c.chr
end
retvalue
end
def self.string_to_binary(value)
value = self.hex_decode(value)
value
end
def self.binary_to_strin...