00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : MD4Hash 00006 * Package : Zeus.ZeusBase.Security 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 /* CODE INFORMATION: 00033 The main code of this class has been taken from the "OpenSSL" Library. 00034 Copyright information from OpenSSL: 00035 */ 00036 /* ==================================================================== 00037 * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. 00038 * 00039 * Redistribution and use in source and binary forms, with or without 00040 * modification, are permitted provided that the following conditions 00041 * are met: 00042 * 00043 * 1. Redistributions of source code must retain the above copyright 00044 * notice, this list of conditions and the following disclaimer. 00045 * 00046 * 2. Redistributions in binary form must reproduce the above copyright 00047 * notice, this list of conditions and the following disclaimer in 00048 * the documentation and/or other materials provided with the 00049 * distribution. 00050 * 00051 * 3. All advertising materials mentioning features or use of this 00052 * software must display the following acknowledgment: 00053 * "This product includes software developed by the OpenSSL Project 00054 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 00055 * 00056 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 00057 * endorse or promote products derived from this software without 00058 * prior written permission. For written permission, please contact 00059 * licensing@OpenSSL.org. 00060 * 00061 * 5. Products derived from this software may not be called "OpenSSL" 00062 * nor may "OpenSSL" appear in their names without prior written 00063 * permission of the OpenSSL Project. 00064 * 00065 * 6. Redistributions of any form whatsoever must retain the following 00066 * acknowledgment: 00067 * "This product includes software developed by the OpenSSL Project 00068 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 00069 * 00070 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 00071 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00072 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00073 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 00074 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00075 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00076 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00077 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00078 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00079 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00080 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00081 * OF THE POSSIBILITY OF SUCH DAMAGE. 00082 * ==================================================================== 00083 * 00084 */ 00085 00086 #ifndef MD4HashH 00087 #define MD4HashH 00088 00089 #define MD4_CBLOCK 64 00090 #define MD4_LBLOCK (MD4_CBLOCK/4) 00091 00092 #include <zeusbase/Security/AbstractMDHash.h> 00093 #include <stdio.h> 00094 00095 BEGIN_NAMESPACE_Zeus 00096 00097 /*****************************************************************************/ 00101 /*****************************************************************************/ 00102 zeusbase_class TMD4Hash : public TAbstractMDHash 00103 { 00104 public: 00105 inline TMD4Hash() {} 00106 00107 protected: 00108 00109 //Methods of TAbstractMDHash 00110 virtual Int getBlockSize() const; 00111 virtual void initCTX(TypeMD_CTX& rCTX); 00112 virtual void processBlock(TypeMD_CTX& rCtx, const Uint8* pucBuffer, Int iBlockNum); 00113 00114 private: 00115 00116 }; 00117 00118 /*****************************************************************************/ 00121 /*****************************************************************************/ 00122 inline Int TMD4Hash::getBlockSize() const 00123 { 00124 return MD4_CBLOCK; 00125 } 00126 00127 END_NAMESPACE_Zeus 00128 00129 #endif