Class: Utils
- Inherits:
-
Object
- Object
- Utils
- Defined in:
- lib/ruby-fcp/utils.rb
Instance Method Summary collapse
- #filehash_maker(ident, filename, conid) ⇒ Object
- #id_generate ⇒ Object
- #packet_mangler(sash, header) ⇒ Object
Instance Method Details
#filehash_maker(ident, filename, conid) ⇒ Object
6 7 8 9 |
# File 'lib/ruby-fcp/utils.rb', line 6 def filehash_maker(ident,filename,conid) content = File.read(filename) (Digest::SHA256.new << conid + "-#{ident}-" + content).base64digest end |
#id_generate ⇒ Object
15 16 17 |
# File 'lib/ruby-fcp/utils.rb', line 15 def id_generate SecureRandom.hex end |
#packet_mangler(sash, header) ⇒ Object
11 12 13 |
# File 'lib/ruby-fcp/utils.rb', line 11 def packet_mangler(sash,header) header +"\n"+ sash.map{|k,v| "#{k}=#{v}"}.join("\n") + "\nEndMessage\n" end |