4

I am looking to encode the identity of a router retrieved from the consensus to give me it's finger print, what is the encoding method used to transform the identity to the fingerprint ?

Thanks

2 Answers 2

1

I'm not entirely sure what you mean by 'the identity of a router retrieved from the consensus'.

But a few guesses:

Finally, the base64 occurring in the second spot in the "r" line in the consensus is the base64 encoding of the raw hex of the fingerprint. So for mine (rittervg, as shown above) you can copy "wO2wjXVA0d08ppgJ7RfZefUbZuM" out of the consensus and see the fingerprint like so (not counting endianness issues):

$ echo "wO2wjXVA0d08ppgJ7RfZefUbZuM" | base64 -d | hexdump
base64: invalid input
0000000 edc0 8db0 4075 ddd1 a63c 0998 17ed 79d9
0000010 1bf5 e366
0000014
0

As I needed something similar for a script I want to give out my approach which is based on Tom's but uses xxd instead to convert the base64 encoded identity to the full fingerprint:

$ echo -n "wO2wjXVA0d08ppgJ7RfZefUbZuM" | base64 --decode 2> /dev/null | xxd --plain | awk '{ print toupper($0) }'
C0EDB08D7540D1DD3CA69809ED17D979F51B66E3

The '2>' stderr redirect to /dev/null omits base64's invalid input warning. Hope this is useful for someone out there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .