Whirlpool errors!
#1

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.
Reply
#2

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

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

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

Yeah. Damn. thats a long ass string lol.
Reply
#6

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)
Reply
#7

Password lengths have to be atleast 129.

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

It is 256.

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

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)