00001 /* ripemd.hpp 00002 * 00003 * Copyright (C) 2003 Sawtooth Consulting Ltd. 00004 * 00005 * This file is part of yaSSL. 00006 * 00007 * yaSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * There are special exceptions to the terms and conditions of the GPL as it 00013 * is applied to yaSSL. View the full text of the exception in the file 00014 * FLOSS-EXCEPTIONS in the directory of this software distribution. 00015 * 00016 * yaSSL is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00024 */ 00025 00026 /* ripemd.hpp provides RIPEMD digest support 00027 */ 00028 00029 #ifndef TAO_CRYPT_RIPEMD_HPP 00030 #define TAO_CRYPT_RIPEMD_HPP 00031 00032 #include "hash.hpp" 00033 00034 namespace TaoCrypt { 00035 00036 00037 // RIPEMD160 digest 00038 class RIPEMD160 : public HASHwithTransform { 00039 public: 00040 enum { BLOCK_SIZE = 64, DIGEST_SIZE = 20, PAD_SIZE = 56, 00041 TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes 00042 RIPEMD160() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) 00043 { Init(); } 00044 ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } 00045 word32 getBlockSize() const { return BLOCK_SIZE; } 00046 word32 getDigestSize() const { return DIGEST_SIZE; } 00047 word32 getPadSize() const { return PAD_SIZE; } 00048 00049 RIPEMD160(const RIPEMD160&); 00050 RIPEMD160& operator= (const RIPEMD160&); 00051 00052 void Update(const byte*, word32); 00053 void Init(); 00054 void Swap(RIPEMD160&); 00055 private: 00056 void Transform(); 00057 void AsmTransform(const byte* data, word32 times); 00058 }; 00059 00060 inline void swap(RIPEMD160& a, RIPEMD160& b) 00061 { 00062 a.Swap(b); 00063 } 00064 00065 00066 } // namespace 00067 00068 #endif // TAO_CRYPT_RIPEMD_HPP 00069
1.4.7

