• Main Page
  • Classes
  • Files
  • File List

Swiften/StringCodecs/SHA1_Windows.h

00001 /*
00002  * Copyright (c) 2012 Kevin Smith
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <vector>
00010 #include <Windows.h>
00011 #define SECURITY_WIN32
00012 #include <security.h>
00013 #include <Wincrypt.h>
00014 
00015 #include <Swiften/Base/API.h>
00016 #include <Swiften/Base/SafeByteArray.h>
00017 
00018 namespace Swift {
00019   class SWIFTEN_API SHA1 {
00020     public:
00021       SHA1();
00022       ~SHA1();
00023 
00024       SHA1& update(const std::vector<unsigned char>& data);
00025       std::vector<unsigned char> getHash() const;
00026 
00027       static ByteArray getHash(const ByteArray& data);
00028       static ByteArray getHash(const SafeByteArray& data);
00029 
00030       ByteArray operator()(const SafeByteArray& data) {
00031         return getHash(data);
00032       }
00033 
00034       ByteArray operator()(const ByteArray& data) {
00035         return getHash(data);
00036       }
00037 
00038     private:
00039       SHA1& update(const unsigned char* data, size_t dataSize);
00040 
00041     private:
00042       HCRYPTHASH hash;
00043   };
00044 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1