/* The software in this package is distributed under the GNU General Public License version 2 (with a special exception described below). A copy of GNU General Public License (GPL) is included in this distribution, in the file COPYING.GPL. As a special exception, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other works to produce a work based on this file, this file does not by itself cause the resulting work to be covered by the GNU General Public License. However the source code for this file must still be made available in accordance with section (3) of the GNU General Public License. This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. */ /** Hashing functions based upon openssl. @copyright Intra2net AG */ #ifndef CRYPTO_HXX #define CRYPTO_HXX #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) using namespace std; #endif #include #include #include namespace I2n { enum algorithm { NONE=0, MD5=1, SHA1=2, SHA256=8, SHA384=9, SHA512=10 }; // output: hex encoded hash string hash_data(string data, algorithm algo); // output: raw binary hash string hash_data_raw(string data, algorithm algo); // hash data in 64kB blocks string hash_file(string filename, algorithm algo); string encode_hex(string data); string encode_hex(char *data, unsigned int size); typedef boost::shared_array char_arr; typedef boost::shared_array uchar_arr; typedef boost::shared_ptr EVP_MD_CTX_Ptr; }; // eo I2n namespace #endif /* [CRYPTO_HXX] */