https://github.com/aksalj/hashlibpp
Simple and very easy to use library to create a cryptographic checksum (hash) in plain C++
https://github.com/aksalj/hashlibpp
Last synced: about 1 month ago
JSON representation
Simple and very easy to use library to create a cryptographic checksum (hash) in plain C++
- Host: GitHub
- URL: https://github.com/aksalj/hashlibpp
- Owner: aksalj
- License: other
- Created: 2013-11-02T08:40:45.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-12-23T15:31:02.000Z (about 11 years ago)
- Last Synced: 2024-08-04T02:10:13.796Z (over 1 year ago)
- Language: C++
- Homepage: http://hashlib2plus.sourceforge.net/index.html
- Size: 219 KB
- Stars: 14
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- AwesomeCppGameDev - hashlibpp
README
hashlib++
=========
`hashlib++` is a simple and very easy to use library to create a cryptographic
checksum called `hash`. It is written in plain C++ and should work with every compiler and platform.
`hashlib++` allows you to create a hash (for example `MD5` or `SHA1`) with only one single method-call. So if you want to create a hash based on a file or a string quickly you might be interested.
By now hashlib++ supports the following functions:
-> MD5 Message-Digest algorithm 5
-> SHA1 Secure Hash Algorithm 1
-> SHA2-Family Secure Hash Algorithm 256, 384 and 512
Run and/or modify `build.sh` to build and use hashlib++
##Sample usage
```cpp
#include
#include
#include //for "cerr"
//creating a wrapper object
hashwrapper *myWrapper = new md5wrapper();
try{
// create a hash from a string
std::string hash1 = myWrapper->getHashFromString("Hello World");
// create a hash based on a file
std::string hash2 = myWrapper->getHashFromFile("README.md");
}catch(hlException &e) {
std::cerr << "Error(" << e.error_number() << "): " << e.error_message() << std::endl;
}
delete myWrapper;
```
#Just give it a try.
See [http://hashlib2plus.sourceforge.net/index.html](http://hashlib2plus.sourceforge.net/index.html) for more info.