pybitmessage.addresses module

src/addresses.py

addBMIfNotPresent(address)[source]

Prepend BM- to an address if it doesn’t already have it

calculateInventoryHash(data)[source]

Calculate inventory hash from object data

decodeAddress(address)[source]

returns (status, address version number, stream number, data (almost certainly a ripe hash))

decodeBase58(string, alphabet='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz')[source]

Decode a Base X encoded string into the number

Arguments: - string: The encoded string - alphabet: The alphabet to use for encoding

decodeVarint(data)[source]

Decodes an encoded varint to an integer and returns it. Per protocol v3, the encoded value must be encoded with the minimum amount of data possible or else it is malformed. Returns a tuple: (theEncodedValue, theSizeOfTheVarintInBytes)

encodeAddress(version, stream, ripe)[source]

Convert ripe to address

encodeBase58(num, alphabet='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz')[source]

Encode a number in Base X

num: The number to encode alphabet: The alphabet to use for encoding

encodeVarint(integer)[source]

Convert integer into varint bytes

exception varintDecodeError[source]

Bases: exceptions.Exception

Exception class for decoding varint data