hashlib - 1.1.0 -
mschnitzer - 22.07.2015
Hey guys,
I know there are already some plugins which are providing some hashing functions but I wrote that plugin (that's my first plugin for SA:MP) to get more experience in plugin development and C++. I also wanna add more hashing functions to that library and keep it up to date. (I will continue working on it if I get more feedback)
What is it about?
The hashlib plugin provides several hashing functions like sha512 with
salting support.
Which functions does the library provide?
Since 1.1.0:
- hashlib_whirlpool
- hashlib_base64_encode
- hashlib_base64_decode
Since 1.0.0:
- hashlib_md5
- hashlib_sha1
- hashlib_sha224
- hashlib_sha256
- hashlib_sha384
- hashlib_sha512
- hashlib_generate_salt
Contribution
If you wanna improve my code or add new functions to the library, (please contact me before you start adding new functions) feel free to open a new pull request on
GitHub.
Download
Last stable release (Version: 1.1.0):
All releases:
https://github.com/mschnitzer/hashlib/releases
Plans for the next release
Examples
https://github.com/mschnitzer/hashlib#example-usage
Thanks to- zedwood.com for providing the hashing libraries
Re: hashlib - 1.0.0 -
maddinat0r - 22.07.2015
Not bad for your first plugin.
There are some things I noticed:
- Why are you compiling all .cpp files in your makefile twice? I guess this is just a mistake.
- You don't need to write your own AMX utility functions, you can just use this plugin SDK/API. It has some utility functions defined in "amx2.h". There are of course other versions of this (Zeex and Dan have their own).
- The "PluginNatives" array in main.cpp should be declared with the 'extern "C"' specifier, since you are passing a C++ array to a C function without it.
- I'd place all content from "Natives.h" directly into "main.cpp", since IMHO header files are meant to be included multiple times in source files (you include it only once in "main.cpp"). This is more of a subjective thing though.
Other than that, good job! Keep it up!
EDIT:
You should also globally define "HAVE_STDINT_H", or else the AMX header won't include stdint.h (which it should, since it's available on pretty much every platform). And if you include "malloc.h" before including "amx.h", you won't get that error/warning with "redefining alloca" (or something like that). If you decide to switch to the plugin SDK I mentioned, you just have to globally define "HAVE_MALLOC_H" (at least on Windows, AFAIK that alloca error/warning does not occur on Linux machines).
Re: hashlib - 1.0.0 -
mschnitzer - 22.07.2015
1. Yes that's actually a mistake. The makefile was a copy & paste thing. I should definitely adjust that.
2. Sounds great. Thanks for the tip. I will use that in future versions.
3. Where's the difference?
4. OK, I actually moved the natives today in a separate file ^^ I thought this is the most common way.
Thanks for your help! I will adjust these things soon.
Re: hashlib - 1.0.0 -
maddinat0r - 22.07.2015
Regarding 3.: This is needed for compatibility reasons. A C++ array is not a POD structure, however a C array is. Since you are passing an array to a C function, the C function expects a C array.
I also edited my last post, just so you know.
Re: hashlib - 1.0.0 -
mschnitzer - 22.07.2015
OK thanks for that. I actually got the "redefining alloca[...]" message when I was using boost in my plugin. That makes it clearer, thanks!
Re: hashlib - 1.0.0 -
zSuYaNw - 22.07.2015
Not bad for your first pluginŠ
Nice Job!
Re: hashlib - 1.0.0 -
mschnitzer - 24.07.2015
@zSuYaNw: Thanks
I released a new version of hashlib (version: 1.1.0). The full changelog can be found on GitHub:
https://github.com/mschnitzer/hashli...ases/tag/1.1.0
Download links has been updated.
@maddinat0r: I implemented your feedback ( except the SDK - that will be added later
)
Re: hashlib - 1.0.0 -
RedLabel - 01.08.2015
Not bad for your first plugin, keep it up!
Re: hashlib - 1.0.0 -
mschnitzer - 15.08.2015
@RedLabel: Thanks
I had to update the include file because I did a mistake there. If you're using my plugin, please update your include file!
Please use the *_BUF constants for the size of an array where a hash gets saved!
https://github.com/mschnitzer/hashli...de/hashlib.inc
Re: hashlib - 1.0.0 -
PT - 15.08.2015
i really like you did here.
nice job.
Re: hashlib - 1.0.0 -
n0minal - 15.08.2015
Nice, pretty useful, congrats!
Re: hashlib - 1.0.0 -
mschnitzer - 25.08.2015
@ipsLeon: Thanks
I added a wiki page for the plugin:
https://github.com/mschnitzer/hashlib/wiki