ucscsdk/ucscgenutils.py
def decrypt_password(cipher, key):
    """
    Decrypts the password using the given key with which the password
    was encrypted first.
    """

    import base64
    from array import array

    try:
        xrange
    except:
        xrange = range

    h_hash = get_sha_hash

    cipher += "\n"
    cipher = base64.decodestring(cipher)
    cipher_len = len(cipher) - 16 - 8

    uhash = cipher[:16]
    password_stream = cipher[16:-8] + "0000"[cipher_len & 3:]
    k_enc = h_hash('enc' + key + uhash)

    password_stream = array('L', password_stream)
    x_key = expand_key(k_enc, cipher_len + 4)

    for i in xrange(len(password_stream)):
        password_stream[i] = password_stream[i] ^ x_key[i]

    decrypted_password = password_stream.tostring()[:cipher_len]
    return decrypted_password

    Decrypts the password using the given key with which the password
    was encrypted first.
    
Decrypts the password using the given key with which the password
was encrypted first.
Decrypts the password using the given key with which the password was encrypted first .
def decrypt_password(cipher, key):
    import base64
    from array import array
    try:
        xrange
    except:
        xrange = range
    h_hash = get_sha_hash
    cipher += "\n"
    cipher = base64.decodestring(cipher)
    cipher_len = len(cipher) - 16 - 8
    uhash = cipher[:16]
    password_stream = cipher[16:-8] + "0000"[cipher_len & 3:]
    k_enc = h_hash('enc' + key + uhash)
    password_stream = array('L', password_stream)
    x_key = expand_key(k_enc, cipher_len + 4)
    for i in xrange(len(password_stream)):
        password_stream[i] = password_stream[i] ^ x_key[i]
    decrypted_password = password_stream.tostring()[:cipher_len]
    return decrypted_password
def decrypt_password ( cipher , key ) : import base64 from array import array try : xrange except : xrange = range h_hash = get_sha_hash cipher += "\n" cipher = base64 . decodestring ( cipher ) cipher_len = len ( cipher ) - 16 - 8 uhash = cipher [ : 16 ] password_stream = cipher [ 16 : - 8 ] + "0000" [ cipher_len & 3 : ] k_enc = h_hash ( 'enc' + key + uhash ) password_stream = array ( 'L' , password_stream ) x_key = expand_key ( k_enc , cipher_len + 4 ) for i in xrange ( len ( password_stream ) ) : password_stream [ i ] = password_stream [ i ] ^ x_key [ i ] decrypted_password = password_stream . tostring ( ) [ : cipher_len ] return decrypted_password
Decrypts the password using the given key with which the password
was encrypted first.
Decrypts the password using the given key with which the password was encrypted first .
"""
    Decrypts the password using the given key with which the password
    was encrypted first.
    """
cipher
key