SEGUID from python to c++
<p>I'm trying to do this in C++, I have some code in Python but I can't figure how to make it work in C++</p>

<pre class="lang-python prettyprint-override"><code>def seguid(seq):

    try:
        #Python 2.5 sha1 is in hashlib
        import hashlib
        m = hashlib.sha1()
    except:
        #For older versions 
        import sha
        m = sha.new()
    import base64
    try:
        #Assume its a Seq object
        seq = seq.tostring()
    except AttributeError:
        #Assume its a string
        pass
    m.update(_as_bytes(seq.upper()))

    try:
        #For Python 2.5+
        return base64.b64encode(m.digest()).rstrip("=")
    except:
        #For older versions
        import os
        #Note: Using os.linesep doesn't work on Windows,
        #where os.linesep= "\r\n" but the encoded string
        #contains "\n" but not "\r\n"
        return base64.encodestring(m.digest()).replace("\n","").rstrip("=")
</code></pre>
