Dev-Cpp + OpenSSL + protokół gadu

0

Witam,
Starsza metoda szyfrowania haseł w Gadu-Gadu jest (chyba) odrzucana, dlatego potrzebuje SHA.
A więc w kompilatorze Dev-Cpp ściągam paczke OpenSSL, następnie gdy już ją zainstaluje w projekcie dodaje: #include <openssl/sha.h>
Problem polega na tym, gdy dodaje funkcje (z godnie z dokumentacją protokołu gg):

char *gg_sha_hash(char *password, unsigned int seed)
{
	SHA1_CTX ctx;
	static char result[20];
	  
	SHA1_Init(&ctx);  
	SHA1_Update(&ctx, password, strlen(password));
	SHA1_Update(&ctx, &seed, sizeof(seed));
	SHA1_Final(result, &ctx);

	return result;
}

Wywala mi:

 C:\Dev-Cpp\main.cpp In function `char* gg_sha_hash(char*, unsigned int)': 
10 C:\Dev-Cpp\main.cpp `SHA1_CTX' undeclared (first use this function) 
  (Each undeclared identifier is reported only once for each function it appears in.) 
10 C:\Dev-Cpp\main.cpp expected `;' before "ctx" 
13 C:\Dev-Cpp\main.cpp `ctx' undeclared (first use this function) 
 C:\Dev-Cpp\Makefile.win [Build Error]  [main.o] Error 1 

W konsolidatorze ładuje jeszcze libssl.a (probowalem jeszcze libeay.a)

Co robię źle?
Dziękuję i proszę o wyrozumiałość.

0
char *gg_sha_hash(const char *password, unsigned int seed)
{
        SHA_CTX ctx;
        static char result[20];
         
        SHA1_Init(&ctx); 
        SHA1_Update(&ctx, password, strlen(password));
        SHA1_Update(&ctx, &seed, sizeof(seed));
        SHA1_Final((unsigned char *)result, &ctx);

        return result;
}

Spróbuj tego. Zajrzyj też tutaj - http://4programmers.net/Forum/viewtopic.php?id=160785

0

dobra smiga :* dzieki :* w protokole gg inaczej jest ta funkcja opisana

1 użytkowników online, w tym zalogowanych: 0, gości: 1