08.07.2013, 19:38
(
Последний раз редактировалось GiamPy.; 09.07.2013 в 12:47.
)
wphashsalted.inc - Easy to Use Hashing Functions | Salts Included | Improve your Passwords' Security
"Two easy to use functions that allow you to hash strings as fast as possible."
Include released under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
#includeapprovedforlazypeople
Functions
Speed Tests
Download
Requirements
"Two easy to use functions that allow you to hash strings as fast as possible."
Include released under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
#includeapprovedforlazypeople
Functions
- WhirlpoolHashUnique(string[], times, salt[], bool: iter_append = false)
string[] - Takes the string you would like to hash.
times - How many times does the function have to hash the string before returning the value.
salt[] - Takes a unique salt that will be concatenated with the string and hashed together.
(R2-only) bool: iter_append - Choose if you'd like to append the salt for every iteration or not. It increase the security but it slightly slows down the process.
returns the Whirlpool hashed string.
Example:
pawn Код:WhirlpoolHashUnique("TestingString", "RandomStringAsSalt", 500, true);
- WhirlpoolHashRandom(string[], times, salt[], salt_length, bool: iter_append = false)
string[] - Takes the string you would like to hash.
times - How many times does the function have to hash the string before returning the value.
salt[] - Reference string that contains the salt returned by randomString();
salt_length - How many characters will contain the salt.
(R2-only) bool: iter_append - Choose if you'd like to append the salt for every iteration or not. It increase the security but it slightly slows down the process.
returns the Whirlpool hashed string.
Example:
pawn Код:// Make sure the local variable length is big enough as you've entered in the hashing function.
new saltUsed[50];
WhirlpoolHashRandom("TestingPassword", saltUsed, 250, 45, true);
pawn Код:
new saltUsed[50], hashedPassword1[129], hashedPassword2[129];
strcat(hashedPassword1, WhirlpoolHashRandom("password", 500, saltUsed, 24), 129);
printf("hashedPassword1 = %s", hashedPassword1);
strcat(hashedPassword2, WhirlpoolHashUnique("password", saltUsed, 500), 129);
printf("hashedPassword2 = %s", hashedPassword2);
if(!strcmp(hashedPassword1, hashedPassword2, false))
print("The password is correct.");
else
print("The password is not correct.");
Testing Code:
pawn Код:new timer = GetTickCount();
print("The entire process just started.");
new saltUsed[50], hashedPassword1[129], hashedPassword2[129];
print("WhirlpoolHashRandom started executing.");
strcat(hashedPassword1, WhirlpoolHashRandom("password", 5000, saltUsed, 24, false), 129);
printf("WhirlpoolHashRandom stopped executing, hash is %s.", hashedPassword1);
print("WhirlpoolHashUnique started executing.");
strcat(hashedPassword2, WhirlpoolHashUnique("password", 5000, saltUsed, false), 129);
printf("WhirlpoolHashUnique stopped executing, hash is %s.", hashedPassword2);
printf("The entire process took %d milliseconds.", GetTickCount() - timer);
Tests done with an Intel Core i7 920 @ 2,67 Ghz - 4 cores, 8 threads
- 100 iterations with salt iteration concatenation:
Quote:
[00:13:39] The entire process just started.
[00:13:39] WhirlpoolHashRandom started executing.
[00:13:39] WhirlpoolHashRandom stopped executing, hash is 48AD51DE0CFE8A30E92ED27040855770FEA716411153A50D47 A61B31704E21DEC9908D28E4C9F681FBA45E4949A4CCB50E42 71803ED47B30ADCF75E22B720C38.
[00:13:39] WhirlpoolHashUnique started executing.
[00:13:39] WhirlpoolHashUnique stopped executing, hash is 48AD51DE0CFE8A30E92ED27040855770FEA716411153A50D47 A61B31704E21DEC9908D28E4C9F681FBA45E4949A4CCB50E42 71803ED47B30ADCF75E22B720C38.
[00:13:39] The entire process took 5 milliseconds.
- 1000 iterations with salt iteration concatenation:
Quote:
[00:14:20] The entire process just started.
[00:14:20] WhirlpoolHashRandom started executing.
[00:14:20] WhirlpoolHashRandom stopped executing, hash is 8DBC216179F6AAB3E52FA4D73760D517FA283FF124559EF4EA E099D6AA009D43AA162EABE70EA179FEA0B608F73861BF1771 71F065B7ECBC52741AC8EE3A93B4.
[00:14:20] WhirlpoolHashUnique started executing.
[00:14:20] WhirlpoolHashUnique stopped executing, hash is 8DBC216179F6AAB3E52FA4D73760D517FA283FF124559EF4EA E099D6AA009D43AA162EABE70EA179FEA0B608F73861BF1771 71F065B7ECBC52741AC8EE3A93B4.
[00:14:20] The entire process took 20 milliseconds.
- 10000 iterations with salt iteration concatenation:
Quote:
[00:14:52] The entire process just started.
[00:14:52] WhirlpoolHashRandom started executing.
[00:14:52] WhirlpoolHashRandom stopped executing, hash is B3D09A9BD8709E5584DDFC5D3CFC70ED9195FE4194F2202200 DAFE1FDCF222DDD28AA795932EB54A607B208187B1FDC5D4E8 78F619899D542EBFFD6A85A00FE6.
[00:14:52] WhirlpoolHashUnique started executing.
[00:14:52] WhirlpoolHashUnique stopped executing, hash is B3D09A9BD8709E5584DDFC5D3CFC70ED9195FE4194F2202200 DAFE1FDCF222DDD28AA795932EB54A607B208187B1FDC5D4E8 78F619899D542EBFFD6A85A00FE6.
[00:14:52] The entire process took 181 milliseconds.
- 25000 iterations with salt iteration concatenation:
Quote:
[00:15:36] The entire process just started.
[00:15:36] WhirlpoolHashRandom started executing.
[00:15:37] WhirlpoolHashRandom stopped executing, hash is 018A7176EEA2869223AAEAC7A458461DB3473B7CFEF5EC5945 D9B2CFA71EDDB326947274EFAEF26127D767FA4765FA51B788 4FF7DAEF571EC7035CB03ABA3139.
[00:15:37] WhirlpoolHashUnique started executing.
[00:15:37] WhirlpoolHashUnique stopped executing, hash is 018A7176EEA2869223AAEAC7A458461DB3473B7CFEF5EC5945 D9B2CFA71EDDB326947274EFAEF26127D767FA4765FA51B788 4FF7DAEF571EC7035CB03ABA3139.
[00:15:37] The entire process took 443 milliseconds.
- 50000 iterations with salt iteration concatenation:
Quote:
[00:17:02] The entire process just started.
[00:17:02] WhirlpoolHashRandom started executing.
[00:17:02] WhirlpoolHashRandom stopped executing, hash is FA43E2B1B572D4CEB5B18FEA98535FD8992D05513F0304053A 92637059ED033FB3E5EC4A2986F2429984324B59FBB3BCB62D F5AB5420B5B330D4A19CA7F25ECC.
[00:17:02] WhirlpoolHashUnique started executing.
[00:17:03] WhirlpoolHashUnique stopped executing, hash is FA43E2B1B572D4CEB5B18FEA98535FD8992D05513F0304053A 92637059ED033FB3E5EC4A2986F2429984324B59FBB3BCB62D F5AB5420B5B330D4A19CA7F25ECC.
[00:17:03] The entire process took 889 milliseconds.
- 100000 iterations with salt iteration concatenation:
Quote:
[00:17:48] The entire process just started.
[00:17:48] WhirlpoolHashRandom started executing.
[00:17:49] WhirlpoolHashRandom stopped executing, hash is CE415C9F912581121E3139CF645F3427057523703CB9F21DC8 5F13088F43ABE3BEE2CF42E5B0864A8F25514959F3FDDD3CCA 5AEF229FFF1E74886128A31134CD.
[00:17:49] WhirlpoolHashUnique started executing.
[00:17:49] WhirlpoolHashUnique stopped executing, hash is CE415C9F912581121E3139CF645F3427057523703CB9F21DC8 5F13088F43ABE3BEE2CF42E5B0864A8F25514959F3FDDD3CCA 5AEF229FFF1E74886128A31134CD.
[00:17:49] The entire process took 1771 milliseconds.
Quote:
R2 - Modified parameters order of WhirlpoolHashRandom. - Added the paramater iter_append to choose if appending the salt for every iteration. It slightly slows down the process but it increases the security. - Fixed minor internal documentation mistakes. R1 - Initial release. |
Requirements
- Whirlpool Plugin - https://sampforum.blast.hk/showthread.php?tid=65290
- ****** - Whirlpool hashing plugin.
- RyDeR` - randomString();
- SchurmanCQC - idea of the script (https://sampforum.blast.hk/showthread.php?tid=417637)