Method: CcipherFactory::Common#disposeOutput

Defined in:
lib/ccipher_factory/helpers/common.rb

#disposeOutput(obj) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ccipher_factory/helpers/common.rb', line 55

def disposeOutput(obj)
  case obj
  when intOutputBuf
    cnt = 0
    len = @intOutputBuf.length
    loop do
      @intOutputBuf.rewind
      @intOutputBuf.write(SecureRandom.random_bytes(len))
      cnt += 1
      break if cnt >= 16
    end
    @intOutputBuf.rewind
    @intOutputBuf = nil
  when intOutputFile
    @intOutputFile.close!
  end
end