IonutIBM Posted January 9, 2021 Report Share Posted January 9, 2021 Salut, am nevoie de ajutor cu sistemul de criptare, sunt incepator si nu stiu prea multe. Quote Link to comment Share on other sites More sharing options...
0 Banditul Posted January 9, 2021 Report Share Posted January 9, 2021 Ceea ce cauti tu nu se numeste criptare, ci hasurare pentru ca la criptare vei avea nevoie de o parola in plus doar pentru a decripta in schimb la hashurare este in inclus direct in string rezultat Ai probleme cu cel actual sau doresti sa implementezi acest sistem? Daca ai probleme cu cel actual doar specifica ce anume nu merge si ce erori intampini Daca vrei sa implementezi unul iti recomand bcrypt https://github.com/lassir/bcrypt-samp #include <a_samp> #include <bcrypt> #define BCRYPT_COST 12 forward OnPasswordHashed(playerid); forward OnPasswordChecked(playerid); public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_REGISTRATION: { bcrypt_hash(inputtext, BCRYPT_COST, "OnPasswordHashed", "d", playerid); } case DIALOG_LOGIN: { // Variable hash is expected to contain the hash loaded from the database bcrypt_check(inputtext, hash, "OnPasswordChecked", "d", playerid); } } return 1; } public OnPasswordHashed(playerid) { new hash[BCRYPT_HASH_LENGTH]; bcrypt_get_hash(hash); printf("Password hashed for player %d: %s", playerid, hash); return 1; } public OnPasswordChecked(playerid) { new bool:match = bcrypt_is_equal(); printf("Password checked for %d: %s", (match) ? ("Match") : ("No match")); return 1; } Acest cod l-am luat direct din exemplul oferit in link acela de la bcrypt. Esssential ce ar trebui sa faci la DIALOG_LOGIN este sa extragi parola curenta din baza de date inainte sa chemi bcrypt_check astfel incat sa se poate verifica si eventual la register sa inserezi/actualizezi parola playerului care tocmai ce si-a facut la OnPasswordHashed astfel incat sa ai parola hashurata Quote GitHub Link to comment Share on other sites More sharing options...
0 IonutIBM Posted January 9, 2021 Author Report Share Posted January 9, 2021 Nu am deloc sistem Quote Link to comment Share on other sites More sharing options...
Question
IonutIBM
Salut, am nevoie de ajutor cu sistemul de criptare, sunt incepator si nu stiu prea multe.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.