def tds7_crypt_pass(password):
    encoded = bytearray(ucs2_codec.encode(password)[0])
    for i, ch in enumerate(encoded):
        encoded[i] = ((ch << 4) & 0xff | (ch >> 4)) ^ 0xA5
    return encoded
Mangle password according to tds rules
dataset/ETHPy150Open denisenkom/pytds/pytds/tds.py/tds7_crypt_pass