//============================================================================== // // Copyright (C) 2002 Dick van Oudheusden // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // //============================================================================== // // $Date: 2003/11/30 11:44:57 $ $Revision: 1.1 $ // //============================================================================== #include #include "ofc/config.h" #include "ofc/DSHA1.h" #include "ofc/DText.h" #include "DInc.h" #include "DTest.h" //-Wrappers-------------------------------------------------------------------- void DSHA1_test(void) { DSHA1 *sha = [DSHA1 alloc]; long l; STARTTEST(); [sha init :"abc"]; TEST([[sha hexdigest] ccompare :"a9993e364706816aba3e25717850c26c9cd0d89d"] == 0); [sha free]; sha = [DSHA1 new]; [sha update :"abc"]; TEST([[sha hexdigest] ccompare :"a9993e364706816aba3e25717850c26c9cd0d89d"] == 0); [sha update :"dbcdecdefdefgefghfghig"]; [sha update :"hijhijkijkljklmklmnlmnomnopnopq"]; TEST([[sha hexdigest] ccompare :"84983e441c3bd26ebaae4aa1f95129e5e54670f1"] == 0); [sha free]; sha = [DSHA1 new]; for (l = 0; l < 1000000; l++) [sha update :"a"]; TEST([[sha hexdigest] ccompare :"34aa973cd4c4daa4f61eeb2bdbad27316534016f"] == 0); [sha free]; STOPTEST(); }