Sha2.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #ifndef ICL_CORE_CRYPT_SHA2_H_INCLUDED
00024 #define ICL_CORE_CRYPT_SHA2_H_INCLUDED
00025 
00026 #include <icl_core/BaseTypes.h>
00027 
00028 #include "icl_core_crypt/Sha2Impl.h"
00029 
00030 namespace icl_core {
00032 namespace crypt {
00033 
00065 template <typename T, T t_h0, T t_h1, T t_h2, T t_h3, T t_h4, T t_h5, T t_h6, T t_h7, size_t t_len>
00066 class Sha2 : public Sha2Impl<T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len>
00067 {
00068 public:
00069   typedef Sha2Impl<T, t_h0, t_h1, t_h2, t_h3, t_h4, t_h5, t_h6, t_h7, t_len> Impl;
00070   using Impl::cMESSAGE_BLOCK_SIZE;
00071   using Impl::cMESSAGE_PAD_POSITION;
00072   using Impl::clear;
00073   using Impl::getHexDigest;
00074 
00076   Sha2();
00077 
00079   Sha2& process(const char *data);
00081   inline Sha2& process(const ::icl_core::String& data)
00082   { return process(data.c_str(), data.size()); }
00084   Sha2& process(const void *data, size_t size);
00085 
00087   Sha2& finalize();
00088 
00089 protected:
00093   void finalizeBuffer(size_t size);
00094 
00095   using Impl::processBuffer;
00096   using Impl::m_digest;
00097   using Impl::m_message_size;
00098   using Impl::m_buffer;
00099   using Impl::m_buffer_fill;
00100 };
00101 
00102 }
00103 }
00104 
00105 #include "icl_core_crypt/Sha2.hpp"
00106 
00107 namespace icl_core {
00108 namespace crypt {
00109 
00111 typedef Sha2<uint32_t,
00112              0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul,
00113              0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul, 7> Sha224;
00115 typedef Sha2<uint32_t,
00116              0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul,
00117              0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul, 8> Sha256;
00119 typedef Sha2<uint64_t,
00120              0xcbbb9d5dc1059ed8ull, 0x629a292a367cd507ull, 0x9159015a3070dd17ull, 0x152fecd8f70e5939ull,
00121              0x67332667ffc00b31ull, 0x8eb44a8768581511ull, 0xdb0c2e0d64f98fa7ull, 0x47b5481dbefa4fa4ull, 6> Sha384;
00123 typedef Sha2<uint64_t,
00124              0x6a09e667f3bcc908ull, 0xbb67ae8584caa73bull, 0x3c6ef372fe94f82bull, 0xa54ff53a5f1d36f1ull,
00125              0x510e527fade682d1ull, 0x9b05688c2b3e6c1full, 0x1f83d9abfb41bd6bull, 0x5be0cd19137e2179ull, 8> Sha512;
00126 
00127 }
00128 }
00129 
00130 #endif


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:24