sql >> Databáze >  >> RDS >> Mysql

Simulace MySql OLD_PASSWORD v .NET nebo MS SQL?

Našel jsem jeden na http://www.yourhelpcenter.de/2009/06/mysql-alten-md5-hash-in-c-berechnen-16-stellig/

public static string mysql_old_password(string sPassword)
{
    UInt32[] result = new UInt32[2];
    bool bDebug = false;
    UInt32 nr = (UInt32)1345345333, add = (UInt32)7, nr2 = (UInt32)0x12345671;
    UInt32 tmp;

    char [] password = sPassword.ToCharArray();
    int i;

    for (i = 0; i < sPassword.Length; i++)
    {
        if (password[i] == ' ' || password[i] == '\t')
            continue;

        tmp = (UInt32)password[i];
        nr ^= (((nr & 63) + add) * tmp) + (nr << 8);
        nr2 += (nr2 << 8 ) ^ nr;
        add += tmp;
    }

    result[0] = nr & (((UInt32)1 << 31) - (UInt32)1);
    UInt32 val = (((UInt32)1 << 31) - (UInt32)1);
    result[1] = nr2 & val;
    string hash = String.Format("{0:X}{1:X}", result[0], result[1]);
    return hash.ToLower();
}


  1. Instalace MySQL-python

  2. 2 cizí klíče odkazující na stejný primární klíč v MySQL

  3. Podpora transakcí motoru MyIsam

  4. SQL Server 2005 ROW_NUMBER() bez ORDER BY