SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 11/02/2009, 02:36 PM   #1
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,082
Reputation: 2512
Default Whirlpool

Whirlpool

Introduction

Very simple plugin. Just provides an implementation of the whirlpool hash algorithm for PAWN. This is so that you don't need to use bad hash systems like MD5, plain awful ones like Adler32 (UDB_Hash) or ones that aren't even true hashes (encode).

Unlike most other hash functions (MD5 and SHA1 included) there are no known weaknesses in whirlpool, so you can be sure your hashes are secure.

Use

This plugin adds just one function:

pawn Code:
native WP_Hash(buffer[], len, const str[]);

So I didn't bother including an include. To use simply call the function, passing a buffer of at least 129 characters, the size of that buffer and the string you want to hash. This used to say 145 but I have no idea why! You need 128 for the hash and 1 for the NULL terminator

Example

pawn Code:
#include <a_samp>

native WP_Hash(buffer[], len, const str[]);

main()
{
    new
        buf[129];
    printf("hash");
    WP_Hash(buf, sizeof (buf), "The quick brown fox jumps over the lazy dog");
    print(buf);
}

That will output:

Code:
B97DE512E91E3828B40D2B0FDCE9CEB3C4A71F9BEA8D88E75C4FA854DF36725FD2B52EB6544EDCACD6F8BEDDFEA403CB55AE31F03AD62A5EF54E42EE82C3FB35
Which is the correct hash for that string.

Notes

If you use YSI that uses a custom key-based hash algorithm, while there are currently no known cracks for it I do not know exactly how secure it is, however the key system vastly improves it's security from server to server. You may want to consider upgrading to Whirlpool however YSI is the only user system which actually bothered with anything resembling security, so it's not required.

As with all my plugins if you place the folder in your SA:MP directory then compiling the plugin will automatically place the new dll or so in your plugins directory.

Reference

http://en.wikipedia.org/wiki/Whirlpool_(cryptography)

Download
  • Source and Windows .dll

http://dl.dropbox.com/u/21683085/Whirlpool.rar

http://www.y-less.com/YSI/Whirlpool.rar
  • 32-bit Linux .so

http://dl.dropbox.com/u/18253648/Whirlpool.so (thanks linuxthefish)
http://www.solidfiles.com/d/1fbbc8fcab/ (thanks pyrodave)
http://www.kowaz.hu/downloads/Whirlpool.so (May be dead)
http://files.uploadffs.com/3/2b87364d/Whirlpool.so (May be dead)
http://www.megaupload.com/?d=89KU5FCG (May be dead)
  • 64-bit Linux .so

http://www.solidfiles.com/d/688303825c/ (thanks Mark™)

Version

I have no intention of modifying this in any way as it works fine. So as far as I'm concerned this is 1.0.

License

* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Beyond that do what you like with it.

Last edited by Y_Less; 11/01/2013 at 05:10 PM.
Y_Less is offline   Reply With Quote
Old 11/02/2009, 07:10 PM   #2
Kowalski
Big Clucker
 
Join Date: Mar 2007
Posts: 101
Reputation: 1
Default Re: Whirlpool

I compiled the project in Ubuntu 8.10 (32bit): http://www.kowaz.hu/downloads/Whirlpool.so
And remove the $(GPP) $(COMPILE_FLAGS) ./Source/*.cpp line from the Makefile, because there isn't a "Source" folder in the package.

Very nice work, I've never heard before about this hashing algorytm.

Ковалски
Kowalski is offline   Reply With Quote
Old 11/02/2009, 07:33 PM   #3
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,819
Reputation: 13
Default Re: Whirlpool

Awesome, I've seen on Seif Admin script that there's an include? :O
MenaceX^ is offline   Reply With Quote
Old 11/02/2009, 07:59 PM   #4
-John-
Big Clucker
 
Join Date: Nov 2007
Location: Zagreb, Croatia
Posts: 97
Reputation: 8
Default Re: Whirlpool

Quote:
Originally Posted by MenaceX^
Awesome, I've seen on Seif Admin script that there's an include? :O
Seifs admin script uses MD5 hashed passwords, and the MD5 include is made by Y_Less too i think

great job Y_Less
-John- is offline   Reply With Quote
Old 12/02/2009, 01:01 PM   #5
Jacob
Little Clucker
 
Join Date: Apr 2005
Posts: 20
Reputation: 0
Default Re: Whirlpool

Nice work. In December 2007 I wrote something similar you may be interested in, SAMPCrypt. It provides cryptographic natives that will hash both strings and files located in \scriptfiles in the following implementations: MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, WHIRLPOOL, and RIPEMD160. All of the algorithm implementations are public domain C code. Intended on adding more but I got bored with it - if you would like I'll upload the code.
Jacob is offline   Reply With Quote
Old 12/02/2009, 02:18 PM   #6
Marcel
Gangsta
 
Join Date: Nov 2007
Posts: 560
Reputation: 2
Default Re: Whirlpool

Y_Less, your link to Wikipedia isn't correct. You're missing a ")" at the end. Then it should be fine.
Marcel is offline   Reply With Quote
Old 12/02/2009, 02:52 PM   #7
Popz
Beta Tester
 
Join Date: Aug 2006
Posts: 169
Reputation: 118
Default Re: Whirlpool

Compiled on 64bit Ubuntu Server 8.04LTS:

http://www.sa-mp.co.uk/data/Whirlpool.so

Good work again Y_Less.
__________________
Popz is offline   Reply With Quote
Old 12/02/2009, 04:31 PM   #8
Slice
High-roller
 
Slice's Avatar
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,858
Reputation: 1234
Default Re: Whirlpool

Great plugin, this will be useful!

Thanks Popz for saving some precious time.
__________________
Do you like SA-MP and DayZ? Come play both: ulclan.com:1421

Do you use any scripts I've made?
Star them on GitHub or reply in their topics so I know what I should keep working on!
Slice is offline   Reply With Quote
Old 12/02/2009, 05:20 PM   #9
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,082
Reputation: 2512
Default Re: Whirlpool

Quote:
Originally Posted by Ковалски
I compiled the project in Ubuntu 8.10 (32bit): http://www.kowaz.hu/downloads/Whirlpool.so
And remove the $(GPP) $(COMPILE_FLAGS) ./Source/*.cpp line from the Makefile, because there isn't a "Source" folder in the package.

Very nice work, I've never heard before about this hashing algorytm.

Ковалски
Added cheers. I'll update the makefile later, it was based on the YSI one, I thought I got everything, apparently not.

Quote:
Originally Posted by Popz
Compiled on 64bit Ubuntu Server 8.04LTS:

http://www.sa-mp.co.uk/data/Whirlpool.so

Good work again Y_Less.
Added cheers.

Quote:
Originally Posted by jacob
Nice work. In December 2007 I wrote something similar you may be interested in, SAMPCrypt. It provides cryptographic natives that will hash both strings and files located in \scriptfiles in the following implementations: MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, WHIRLPOOL, and RIPEMD160. All of the algorithm implementations are public domain C code. Intended on adding more but I got bored with it - if you would like I'll upload the code.
I knew you had written one like this, but I thought it wasn't released. I'm not too bothered about the code as as you said they're in the public domain and I've written MD5 in PAWN before, but I'm sure others would benefit from it. So it's entirely up to you. Actually come to think of it I wouldn't mind seeing how you implemented them, even if just for interest.
Y_Less is offline   Reply With Quote
Old 12/02/2009, 05:22 PM   #10
Amit_B
Gangsta
 
Amit_B's Avatar
 
Join Date: Nov 2007
Location: Israel
Posts: 682
Reputation: 53
Default Re: Whirlpool

Nice work.
__________________
- Leading the Israeli SA-MP Community, SA-MP.co.il - SAMP-IL
- Currently working on the first anime project on SA-MP, Naruto Shippuden gamemode: Screenshots #1, Screenshots #2
Amit_B is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS]L.A.S LuX Admin System |UPDATE: 7/03[v1.6]|Whirlpool+Many CMDS+VIP+Much More LuxurioN™ Filterscripts 2078 26/09/2014 04:15 PM
[FilterScript] [FS] SPK Admin v1 (Beta) | 21 commands | IRC Support | Whirlpool SloProKiller Filterscripts 49 03/05/2012 04:51 AM
[FilterScript] [FS]mmrkAdmin [v1.0.3c] [Using Whirlpool password hash] mmrk Filterscripts 21 14/09/2010 09:37 AM
Whirlpool errors! Gyvo Help Archive 8 07/03/2010 09:29 AM
Whirlpool doesnt encrypt anything virtualmarc Help Archive 2 08/03/2009 12:39 AM


All times are GMT. The time now is 02:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.