Method: PathgraphEncoding.pack

Defined in:
lib/pathgraph_encoding.rb

.pack(k, m, set) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pathgraph_encoding.rb', line 7

def self.pack(k, m, set)
  OpenSSL::ASN1::Sequence.new([
    OpenSSL::ASN1::Integer.new(k),
    OpenSSL::ASN1::Integer.new(m),
    OpenSSL::ASN1::Sequence.new(
      set.map { |path| 
        OpenSSL::ASN1::Sequence.new(
          path.map { |x| OpenSSL::ASN1::Integer.new(x) }
        )
      }
    )
  ]).to_der
end