Question

I am trying to configure and eepsite and their base32 is too long, does i2p use b32 or sha256? or b32 converted to 256, for an eepsite? the example given is 52 characters http://www.i2p2.de/naming.html#base32 and base32 is not 52 characters, it's 32 characters http://online-calculators.appspot.com/base32/ . What am I missing? Is there a tool that addresses i2p specifically?

Was it helpful?

Solution

Base32 is a notation for encoding arbitrary byte data. There is no restriction on the maximum length of Base32-encoded data - the "32 characters" refers to the set of characters that are used to write the arbitrary byte data in Base32 notation. The resulting string will only contain characters from that set. The only restriction is that the length of the Base32-encoded string must be a multiple of 40 bits.

The Base32 addresses in I2P are the Base32 encoding of the SHA256 hash of the I2P Destination.

Here is a Python script to convert Base64-encoded I2P Destinations into an I2P B32 address (from the i2p.scripts branch in the I2P Monotone repositories):

#!/usr/bin/env python
#
# Written by duck
# http://forum.i2p/viewtopic.php?t=4367
#
import base64, hashlib, sys

if len(sys.argv) != 2:
    print 'Usage: 64to32.py <base64key>'
    sys.exit(1)

key = sys.argv[1]
raw_key = base64.b64decode(key, '-~')
hash = hashlib.sha256(raw_key)
base32_hash = base64.b32encode(hash.digest())
print base32_hash.lower().replace('=', '')+'.b32.i2p
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top