Mercurial > code
diff C++/modules/Hash/hash.h @ 485:898d8b29a4f1
Switch to lowercase filenames
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 12 Nov 2015 21:53:36 +0100 |
parents | C++/modules/Hash/Hash.h@d5ec1174b707 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C++/modules/Hash/hash.h Thu Nov 12 21:53:36 2015 +0100 @@ -0,0 +1,65 @@ +/* + * hash.h -- hash functions + * + * Copyright (c) 2013-2015 David Demelier <markand@malikania.fr> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _HASH_H_ +#define _HASH_H_ + +/** + * @file hash.h + * @brief Hash functions + */ + +#include <string> + +namespace hash { + +/** + * Hash using MD5. + * + * @param input the input string + * @return the hashed string + */ +std::string md5(const std::string &input); + +/** + * Hash using SHA1. + * + * @param input the input string + * @return the hashed string + */ +std::string sha1(const std::string &input); + +/** + * Hash using SHA256. + * + * @param input the input string + * @return the hashed string + */ +std::string sha256(const std::string &input); + +/** + * Hash using SHA512. + * + * @param input the input string + * @return the hashed string + */ +std::string sha512(const std::string &input); + +} // !hash + +#endif // !_HASH_H_