Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Hash Plugin test script
- */
- #include <a_samp>
- #include <hash>
- main() { }
- new password[] = "The quick brown fox jumps over the lazy dog.";
- new iterations = 150000;
- new pbkdf2_hash[PBKDF2_LENGTH + 1], pbkdf2_salt[PBKDF2_LENGTH + 1];
- compute()
- {
- hash_generate(password, iterations, "OnPasswordHash", "i", GetTickCount());
- }
- validate()
- {
- hash_validate(password, pbkdf2_hash, pbkdf2_salt, iterations, "OnPasswordValidate", "i", GetTickCount());
- }
- forward OnPasswordHash(tick);
- public OnPasswordHash(tick)
- {
- hash_retrieve(pbkdf2_hash, pbkdf2_salt);
- validate();
- printf("OnPasswordHash %ims", hash_exec_time());
- return 1;
- }
- forward OnPasswordValidate(tick);
- public OnPasswordValidate(tick)
- {
- if(hash_is_equal()) {
- print("Correct password!");
- } else {
- print("Invalid password!");
- }
- printf("OnPasswordValidate %ims", hash_exec_time());
- return 1;
- }
- public OnGameModeInit()
- {
- hash_thread_limit(3);
- compute();
- new string1[10] = "YoSup?";
- new string2[10] = "Yosup?";
- if(slow_equals(string1, string2))
- {
- print("string1 == string2");
- } else print("string1 != string2");
- new pseudorandom_string[65];
- for(new i = 0; i < 3; i++)
- {
- random_string(64, pseudorandom_string, sizeof(pseudorandom_string));
- printf("random_string: %s (len: %i)", pseudorandom_string, strlen(pseudorandom_string));
- printf("random_int: %i", random_int(0, 100));
- }
- new string[64] = "The quick brown fox jumps over the lazy dog.";
- new hash[129];
- print(string);
- sha256(string, hash);
- printf("sha256: %s (%i)", hash, strlen(hash));
- sha384(string, hash);
- printf("sha384: %s (%i)", hash, strlen(hash));
- sha512(string, hash);
- printf("sha512: %s (%i)", hash, strlen(hash));
- whirlpool(string, hash);
- printf("whirlpool: %s (%i)", hash, strlen(hash));
- ripemd160(string, hash);
- printf("ripemd160: %s (%i)", hash, strlen(hash));
- ripemd256(string, hash);
- printf("ripemd256: %s (%i)", hash, strlen(hash));
- ripemd320(string, hash);
- printf("ripemd320: %s (%i)", hash, strlen(hash));
- new file[32] = "server.cfg";
- new checksum[129];
- print(file);
- md5sum(file, checksum);
- printf("md5sum: %s", checksum);
- sha1sum(file, checksum);
- printf("sha1sum: %s", checksum);
- sha256sum(file, checksum);
- printf("sha256sum: %s", checksum);
- sha384sum(file, checksum);
- printf("sha384sum: %s", checksum);
- sha512sum(file, checksum);
- printf("sha512sum: %s", checksum);
- wpsum(file, checksum);
- printf("wpsum: %s", checksum);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement