CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/proto/kademlia/util_spec.rb
Views: 11789
1
# -*- coding: binary -*-
2
#
3
require 'spec_helper'
4
5
RSpec.describe Rex::Proto::Kademlia do
6
7
describe '#decode_peer_id' do
8
subject(:kad) { described_class.decode_peer_id(bytes) }
9
let(:bytes) { "\x00\x60\x89\x9B\x0A\x0B\xBE\xAE\x45\x35\xCB\x0E\x07\xA1\x77\x71" }
10
it 'decodes a peer ID properly' do
11
is_expected.to eq('9B896000AEBE0B0A0ECB35457177A107')
12
end
13
end
14
15
describe '#encode_peer' do
16
skip 'encodes a peer ID properly' do
17
bytes = "\x00\x60\x89\x9B\x0A\x0B\xBE\xAE\x45\x35\xCB\x0E\x07\xA1\x77\x71"
18
peer_id = "9B896000AEBE0B0A0ECB35457177A107"
19
expect(kad.encode_peer_id(peer_id)).to eq(bytes)
20
end
21
end
22
end
23
24