Module: KRB5::Mixin::Unpacker

Included in:
KeytabParser
Defined in:
lib/krb5/mixin/unpacker.rb

Instance Method Summary collapse

Instance Method Details

#unpack_bytes(length) ⇒ Array

Unpack raw bytes

Parameters:

  • length (Integer)

    number of bytes to unpack

Returns:

  • (Array)

    raw bytes



10
11
12
13
14
15
# File 'lib/krb5/mixin/unpacker.rb', line 10

def unpack_bytes(length)
  data = bytes[@index, length]
  @index += length

  data
end

#unpack_int16Object



24
25
26
27
28
29
# File 'lib/krb5/mixin/unpacker.rb', line 24

def unpack_int16
  data = bytes[@index, 2].unpack1('s>')
  @index += 2

  data
end

#unpack_int32Object



31
32
33
34
35
36
# File 'lib/krb5/mixin/unpacker.rb', line 31

def unpack_int32
  data = bytes[@index, 4].unpack1('l>')
  @index += 4

  data
end

#unpack_int8Object



17
18
19
20
21
22
# File 'lib/krb5/mixin/unpacker.rb', line 17

def unpack_int8
  data = bytes[@index].unpack1('c')
  @index += 1

  data
end