Class: CryptBufferInputConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto-toolbox/crypt_buffer_input_converter.rb

Instance Method Summary collapse

Instance Method Details

#convert(input) ⇒ Object



4
5
6
# File 'lib/crypto-toolbox/crypt_buffer_input_converter.rb', line 4

def convert(input)
  bytes_from_any(input)
end

#from_hex(input) ⇒ Object

Make sure input strings are always interpreted as hex strings This is especially useful for unknown or uncertain inputs like strings with or without leading 0x



11
12
13
14
15
16
17
# File 'lib/crypto-toolbox/crypt_buffer_input_converter.rb', line 11

def from_hex(input)
  hexstr =""
  unless input.nil?
    hexstr = normalize_hex(input)
  end
  CryptBuffer.new(hex2bytes(hexstr))
end