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 ?
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