| 226 * \param result Bufor na wynik funkcji skrĂłtu (20 bajtĂłw) |
226 * \param result Bufor na wynik funkcji skrĂłtu (20 bajtĂłw) |
| 227 */ |
227 */ |
| 228 void gg_login_hash_sha1(const char *password, uint32_t seed, uint8_t *result) |
228 void gg_login_hash_sha1(const char *password, uint32_t seed, uint8_t *result) |
| 229 { |
229 { |
| 230 SHA_CTX ctx; |
230 SHA_CTX ctx; |
| 231 |
231 |
| 232 SHA1_Init(&ctx); |
232 SHA1_Init(&ctx); |
| 233 SHA1_Update(&ctx, (const unsigned char*) password, strlen(password)); |
233 SHA1_Update(&ctx, (const unsigned char*) password, strlen(password)); |
| 234 seed = gg_fix32(seed); |
234 seed = gg_fix32(seed); |
| 235 SHA1_Update(&ctx, (uint8_t*) &seed, 4); |
235 SHA1_Update(&ctx, (uint8_t*) &seed, 4); |
| 236 |
236 |
| 237 SHA1_Final(result, &ctx); |
237 SHA1_Final(result, &ctx); |
| 238 } |
238 } |
| 239 |
239 |
| 240 /** |
240 /** |
| 241 * \internal Liczy skrĂłt SHA1 z pliku. |
241 * \internal Liczy skrĂłt SHA1 z pliku. |