Turning uppercase to lowercase?
#1

I made a function to turn md5 hashes like 5D41402ABC4B2A76B9719D911017C592 to 5d41402abc4b2a76b9719d911017c592.

Essentially all it does it make it lowercase. For some reason though, its making funky things like this: И””Ђ

Heres the function and the string in which i call it.

pawn Код:
stock Lowercase(text[])
{
    for(new i; i< 32; i++)
    {
        text[i] = tolower(text[i]);
    }
    return text;
}

format(query,sizeof(query),"SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",PlayerName(playerid),Lowercase(MD5_Hash(string)));
Final Query: [23:09:23] CMySQLHandler::Query(SELECT * FROM `users` WHERE `username` = 'Whatcha' AND `password` = 'И””Ђ' LIMIT 1) - Successfully executed.
Reply
#2

Use prints after the tolower() line to determine if the character is going lowercase or not.
Reply
#3

wrong section.. b
Reply
#4

@whatthefuck123 Sorry. Didnt realize that. I was really tired at the time.

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Use prints after the tolower() line to determine if the character is going lowercase or not.
I did a short debug and heres the result.

Function:
pawn Код:
stock Lowercase(text[])
{
    print(text);
    for(new i; i< 32; i++)
    {
        text[i] = tolower(text[i]);
    }
    print(text);
    return text;
}
Under OnGamemodeInit:
pawn Код:
print(Lowercase(MD5_Hash("Hello")));
Final Result:
[18:55:18] 8B1A9953C4611296A827ABF8C47804D7 (First print in Lowercase function)
[18:55:18] 8b1a9953c4611296a827abf8c47804d7 (Second print in lowercase function)
[18:55:18] **Unarmed (Print under OnGamemodeInit)

Its erroring in the return...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)