decrypting udb_hash?
#1

Does anyone have a stock for it?

pawn Код:
stock udb_hash(buf[]) { //Credits to Dracoblue
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Reply
#2

Why do you need it?
Reply
#3

Why?

Ther should never be a need to decrypt a hash.
Only thing i can see is for password recovery and even that can be
Handled with out decrypting the hash
Reply
#4

pawn Код:
CMD:changepassword(playerid, params[])
{
    if(isnull(params))
        return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/changepassword <new password>");
       
    accInfo[playerid][Passcode] = udb_hash(params);
   
    new
        INI:accFile = INI_Open(find_accPath(playerid) );
       
    INI_SetTag(accFile,     "data");
    INI_WriteInt(accFile,   "Passcode",     udb_hash(params) );
       
    INI_Close(accFile);
   
    format(pwStr, sizeof(pwStr), ""#CYAN"» "#WHITE"Your password has been changed from \"%s\" to \"%s\"", oldPass, params);
    SendClientMessage(playerid, -1, pwStr);
    return true;
}
Of course, the oldPass is why I need it.
Reply
#5

Is it a requirement to print the oldpass?
Reply
#6

No, no, I don't think you understand.

I want to send the player a message with their (decrypted) old password (i have to decrypt it, otherwise it's just a bunch of numbers), and their new password.
Reply
#7

Hashes are always 1-way and cannot be decrypted. There is a difference between encrypting and encoding.
Reply
#8

Dont do it that way,
Require them to write old pass and new pass when changing,
Then save the non hashed old pass for display
Reply
#9

Quote:
Originally Posted by Madd Kat
Посмотреть сообщение
Dont do it that way,
Require them to write old pass and new pass when changing,
Then save the non hashed old pass for display
Alright, I will do it this way. Thanks anyways.

Quote:
Originally Posted by Vince
Посмотреть сообщение
Hashes are always 1-way and cannot be decrypted. There is a difference between encrypting and encoding.
I was not aware of this. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)