T
Travis Warlick
I have implemented a sanitize! method into the String class to
properly erase Strings from memory (example usage: clearing a password
from memory), but I want to make sure that what I'm doing is actually
doing what I think it is.
Basically, is this code going to leave _anything_ lying around in
memory because of any undocumented/strange behavior or side effects of
the []= method?
class String
def sanitize!
for i in 0...self.length
self = 0
end
self.delete!("\000")
end
end
Also, feel free to recommend any "better" ways to do this.
--
Travis
"You get it, hm? But it's not your head
that needs to understand!"
-- Hatsumi O'Sensei
properly erase Strings from memory (example usage: clearing a password
from memory), but I want to make sure that what I'm doing is actually
doing what I think it is.
Basically, is this code going to leave _anything_ lying around in
memory because of any undocumented/strange behavior or side effects of
the []= method?
class String
def sanitize!
for i in 0...self.length
self = 0
end
self.delete!("\000")
end
end
Also, feel free to recommend any "better" ways to do this.
--
Travis
"You get it, hm? But it's not your head
that needs to understand!"
-- Hatsumi O'Sensei