SA-MP Forums Archive
Whirlpool errors! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whirlpool errors! (/showthread.php?tid=132244)



Whirlpool errors! - Gyvo - 06.03.2010

Whirlpool is not working. It encrypts the password but wrongly...

The code:
Код:
public OnPlayerText(playerid, text[])
{
	new string[256];
	if (MenuShown[playerid] == true)
	{
	  strmid(PassBox[playerid], text, 0, strlen(text), 128);
		TextDrawSetString(Pass[playerid], "Wrong password");
		WP_Hash(string, sizeof(string), PassBox[playerid]);
		printf("DebugPassword: %s", string);
		PlayerLogIn(playerid, string);
	  return false;
	}
When a player enters their password, for example "lol". The encrypted password should be "22FB46E1955A8AEB31C59D" but what the WP_Hash returns is: "22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA 2455CC78BC0147B10DD477201D147E2F5CA910BB43D9823204 78B9D179DDDE85F4806497FE2EE68"

As you can see, it starts off with the right stuff then it goes into another planet....

I have also tried WP_Hash(string, sizeof(string), "lol") and that returns "22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA 2455CC78BC0147B10DD477201D147E2F5CA910BB43D9823204 78B9D179DDDE85F4806497FE2EE68"

Please help me. Thanks.



Re: Whirlpool errors! - Gyvo - 06.03.2010

So you're telling me it should be "22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA 2455CC78BC0147B10DD477201D147E2F5CA910BB43D9823204 78B9D179DDDE85F4806497FE2EE68"?


Re: Whirlpool errors! - Fj0rtizFredde - 06.03.2010

Yes The password "lol" will be 22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA2 455CC78BC0147B10DD477201D147E2F5CA910BB43D98232047 8B9D179DDDE85F4806497FE2EE68 with whirlpool


Re: Whirlpool errors! - woot - 06.03.2010

I guess what you are thinking off is MD5 according to the string length. Whirlpool indeed outputs long strings as posted by Seif.


Re: Whirlpool errors! - Gyvo - 06.03.2010

Yeah. Damn. thats a long ass string lol.


Re: Whirlpool errors! - Gyvo - 06.03.2010

While debugging... I've found this:

Код:
[23:09:32] 22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA2455CC78BC0147B10DD477201D147E2F5CA910BB43D982320478B9D179DDDE85F4806497FE2EE68 - 1
[23:09:32] 22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA2455CC78BC0147B10DD477201D147E2F5CA910BB43D982320478B9D179DDDE85F4806497FE2EE68 - 2
[23:09:32] 22FB46E1955A8AEB31C59D - 5
[23:09:32] 22FB46E1955A8AEB31C59D - 3
[23:09:38] 22FB46E1955A8AEB31C59D - 4
As you can see the problem starts at debug #5...

The code for that is...

Код:
public PlayerLogIn(playerid, password[])
{
  new string2[128];
	format(string2, sizeof(string2), "Accounts/%s.ini", PlayerName(playerid));
	new File: UserFile = fopen(string2, io_read);
	if (UserFile)
	{
		new Data[256];
		new key[256], val[256];
	  fread(UserFile , Data, sizeof(Data));
	  key = ini_GetKey(Data);
	  if(strcmp(key, "Password", true) == 0)
		{
			val = ini_GetValue(Data);
			strmid(PlayerInfo[playerid][pPassword], val, 0, strlen(val)-1, 255);
			printf("%s - 5", PlayerInfo[playerid][pPassword]);
		}
		if(strcmp(PlayerInfo[playerid][pPassword], password, true) == 0)



Re: Whirlpool errors! - Joe Staff - 06.03.2010

Password lengths have to be atleast 129.

Check the enum for PlayerInfo[playerid][pPassword] and make sure it's atleast 129


Re: Whirlpool errors! - Gyvo - 06.03.2010

It is 256.

This line is the big problem
Код:
strmid(PlayerInfo[playerid][pPassword], val, 0, strlen(val)-1, 255);



Re: Whirlpool errors! - Gyvo - 07.03.2010

I don't know how to tell it where to start... and where to end... It should start after "Password=" and finish before "Name="

Код:
			printf("%s - 52", PlayerInfo[playerid][pPassword]);
			strmid(PlayerInfo[playerid][pPassword], val, 0, strlen(val)-1, 129);
			printf("%s - 5", PlayerInfo[playerid][pPassword]);
log:
Код:
[23:56:11] 22FB46E1955A8AEB31C59D79D887D02AF2D1BC4524E85AAFA2455CC78BC0147B10DD477201D147E2F5CA910BB43D982320478B9D179DDDE85F4806497FE2EE68 - 52
[23:56:11] 22FB46E1955A8AEB31C59DName=PlayerName - 5
Does anyone know what to do?