AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to fix - warning 233: symbol md5 (https://forums.alliedmods.net/showthread.php?t=324731)

fum77 05-25-2020 10:00

How to fix - warning 233: symbol md5
 
Hi guys. Today I've tried to compile an older plugin with the Compiler 1.9.0.5249.
I got an error that I don't know how to fix.
The error line: warning 233: symbol "md5" is marked as deprecated: Use hash_string() function. Also, see Hash_* constants.
And this is the cod from the sma

PHP Code:

stock convert_password(const password[])
{
    new 
pass_salt[64], converted_password[34];

    
formatex(pass_saltcharsmax(pass_salt), "%s%s"passwordSALT)
    
md5(pass_saltconverted_password)
    
    return 
converted_password



I want to thank you in advance for any information or help.
I hope you are all well in this period we are going through.
#stayathome #besafe

OciXCrom 05-25-2020 10:10

Re: How to fix - warning 233: symbol md5
 
It's not an error, it's a warning and the code still compiled fine. You have an explanation on how to fix it in the warning itself.

Deprecation warnings mean that there is better new alternative for the functions used inside the code. In this case "hash_string" is a better alternative for the old "md5" function.

fum77 05-25-2020 10:29

Re: How to fix - warning 233: symbol md5
 
Thank you so much for your fast reply to my post.
I made that change when I first get the "warning"

PHP Code:

stock convert_password(const password[])
{
    new 
pass_salt[64], converted_password[34];

    
formatex(pass_saltcharsmax(pass_salt), "%s%s"passwordSALT)
    
hash_string(pass_saltconverted_password)
    
    return 
converted_password


Now I get an error :D
RegisterSystem.sma(2781) : error 035: argument type mismatch (argument 2)

Can you pls make this change for me on an example code?
I'm sure hash_string is not write how it has to be.

Thank you again.

iceeedr 05-25-2020 11:03

Re: How to fix - warning 233: symbol md5
 
Checking the API I believe it is this way, I have not tested it.

PHP Code:

stock convert_password(const password[])
{
    new 
pass_salt[64], converted_password[34];

    
formatex(pass_saltcharsmax(pass_salt), "%s%s"passwordSALT)
    
hash_string(pass_saltHash_Md5converted_passwordcharsmax(converted_password))

    return 
converted_password



fum77 05-25-2020 11:22

Re: How to fix - warning 233: symbol md5
 
.Done
That was the right way to write the code.
Thank you so much iceeedr and OciXChrom
Take care!

fysiks 05-25-2020 14:01

Re: How to fix - warning 233: symbol md5
 
You should read the documentation for the new function before you use it because a deprecated function isn't always replaced by an exact duplicate (which would make no sens and the function wouldn't be deprecated).

fum77 05-25-2020 16:13

Re: How to fix - warning 233: symbol md5
 
Quote:

Originally Posted by fysiks (Post 2702274)
You should read the documentation for the new function before you use it because a deprecated function isn't always replaced by an exact duplicate (which would make no sens and the function wouldn't be deprecated).

I already read the documentation before the post but I don't understand much of what it says there. I don't know the pawn language but I want to learn it for the future. From long time I was thinking on learn how to create my own plugins. But I never done it. :(
Thanks for the advice I will keep that in mind.
Take care fysiks

fysiks 05-25-2020 19:16

Re: How to fix - warning 233: symbol md5
 
If you didn't understand it, let us know so we can help you learn it. Also, showing that you're actually putting in some effort will help build your credibility around here. Saying "do this for me" is the worst thing that a person can say in the Scripting Help section.


All times are GMT -4. The time now is 16:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.