Addrtype

Trying feature branches, still not sure I did it right.
This base58 fix should work (but looks terrible, feel free to rewrite).
To view all changes use 'Diff' button up here (separate commits do not make sense).

I've used tests.py for unit tests, here it is (addresses made by vanitygen):

```python
import bitcoin

def check_addr(addrtype, addr):
    bitcoin.addrtype = addrtype
    key = bitcoin.address_to_key(addr)
    addr_res = bitcoin.key_to_address(key)
    print "prefix %d, %d bytes:\n %s\n %s" % (addrtype, len(key), addr, addr_res)

def test_addr():
    # regular
    check_addr(0, '111pUniM4FDyzzqUEnAFnGjiAAjvJXGHH')
    check_addr(0, '123CrJxHRTN2CMHctb2eY6hgXjundR7TYk')
    # testnet
    check_addr(111, 'mnorSNMwfa8qoo6o5WxcQGk2bM1FW62gcW')
    check_addr(111, 'n3UujJA86tP4eNrNcEm6iak3snZH73AmCW')
    # private keys
    check_addr(0+128, '5Jr9HyPQFr16hp1GgYBeTfy7LQ4o2smTBjEK3V3u1CiDaG4Tuhy')
    check_addr(0+128, '5Jcrw1AorYxPnoAw84Ze5i98FcksTDTT1nb7HYJuVwa3wYJRBJa')
    check_addr(111+128, '92U9JfnevJTobRwn8S9SkTew8rcfh8UezH6CsZFssr3Q85QgR4x')
    check_addr(111+128, '93MF7bFx9egsUSmFxwx9pGtvzCVU7TkeQts63BzCdpb5CA8Tr8y')

if __name__ == '__main__':
    test_addr()
```
Also, a few notes (it would be much faster then rebasing everything).

1) ecdsa_ssl.py does not work without this on win32:

```diff
-ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl'))
+ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')

```

2)  inet_ntop and inet_pton not presented in win32 version of the socket module (python 2.7), had to use these functions (I would have a better soultion but apparently there's none, don't know really):

```python
def inet_ntop(af, addr):
    if af == socket.AF_INET:
        return socket.inet_ntoa(addr)
    elif af == socket.AF_INET6:
        if len(addr) != 16:
            raise ValueError("address length incorrect")
        parts = struct.unpack('!8H', addr)
        curBase = bestBase = None
        for i in range(8):
            if not parts[i]:
                if curBase is None:
                    curBase = i
                    curLen = 0
                curLen += 1
            else:
                if curBase is not None:
                    if bestBase is None or curLen > bestLen:
                        bestBase = curBase
                        bestLen = curLen
                    curBase = None
        if curBase is not None and (bestBase is None or curLen > bestLen):
            bestBase = curBase
            bestLen = curLen
        parts = [hex(x)[2:] for x in parts]
        if bestBase is not None:
            parts[bestBase:bestBase + bestLen] = ['']
        if parts[0] == '':
            parts.insert(0, '')
        if parts[-1] == '':
            parts.insert(len(parts) - 1, '')
        return ':'.join(parts)
    else:
        raise socket.error(97, 'Address family not supported by protocol')
```

```python
def inet_pton(af, addr):
    if af == socket.AF_INET:
        return socket.inet_aton(addr)
    elif af == getattr(socket, 'AF_INET6', 'AF_INET6'):
        if [x for x in addr if x not in string.hexdigits + ':.']:
            raise ValueError("Illegal characters: %r" % (''.join(x),))

        parts = addr.split(':')
        elided = parts.count('')
        ipv4Component = '.' in parts[-1]

        if len(parts) > (8 - ipv4Component) or elided > 3:
            raise ValueError("Syntactically invalid address")

        if elided == 3:
            return '\x00' * 16

        if elided:
            zeros = ['0'] * (8 - len(parts) - ipv4Component + elided)

            if addr.startswith('::'):
                parts[:2] = zeros
            elif addr.endswith('::'):
                parts[-2:] = zeros
            else:
                idx = parts.index('')
                parts[idx:idx+1] = zeros

            if len(parts) != 8 - ipv4Component:
                raise ValueError("Syntactically invalid address")
        else:
            if len(parts) != (8 - ipv4Component):
                raise ValueError("Syntactically invalid address")

        if ipv4Component:
            if parts[-1].count('.') != 3:
                raise ValueError("Syntactically invalid address")
            rawipv4 = socket.inet_aton(parts[-1])
            unpackedipv4 = struct.unpack('!HH', rawipv4)
            parts[-1:] = [hex(x)[2:] for x in unpackedipv4]

        parts = [int(x, 16) for x in parts]
        return struct.pack('!8H', *parts)
    else:
        raise socket.error(97, 'Address family not supported by protocol')

```

3) Block downloading doesn't work without a fix. Doesnt work AT ALL (I connect to official 0.3.24 win32 client). Checked with today's commits of caesure, it still doesn't work. Still not sure why, but it stops completely after the first (genesis) block. Had to add the following (probably broke the chain, also looks like I'm always 1 block late):

```diff
                else:
                    # case 2: it links to neither (problem or lame hack attempt?)
                    #    * toss it
                    print 'tossing orphan block: %s' % (name,)
                    self.orphan_blocks ([(name, block)])

+            if name == genesis_block_hash:
+                print "we got genesis block"
+                self.last_block = '00' * 32
+                self.prev[self.last_block] = True
+                self.release_embargo(name, block)
+                del self.embargo[name]
```
There is also a certain inconsistency between ecdsa_ssl and ecdsa_pure, that I tried to fix (see https://github.com/joric/brutus/blob/master/ecdsa_pure.py). All code is free to use.

EDIT: maybe it's better to specify key length explicitly (e.g. 20 bytes for public keys (type 0-127) and 32 bytes for secret keys (type 128-255) somewhere in the related code, I'm not quite sure).