- removed unportable clock() used time() instead
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@444 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -54,8 +54,7 @@ int main (void)
|
||||
int result, i, j, cnt;
|
||||
byte *hashcode;
|
||||
byte hashref[] = {0xFC,0x20,0x7B,0x84,0x40,0x1C,0x49,0x0B,0x8D,0x69,0x88,0xD2,0x49,0x20,0x01,0x90,0x41,0x77,0x72,0x59};
|
||||
volatile int *pLED = (int*)sys_led_port;
|
||||
char msg[MSG_SIZE/8];
|
||||
char msg[MSG_SIZE/8+1];
|
||||
char crlf[] = "\n";
|
||||
UINT32 start, stop;
|
||||
|
||||
@@ -67,24 +66,34 @@ int main (void)
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
cnt = 0;
|
||||
start = clock();
|
||||
stop = start + 1000;
|
||||
start = time(NULL);
|
||||
stop = start + 1;
|
||||
while(1)
|
||||
{
|
||||
hashcode = RMD((byte *)msg);
|
||||
start = clock();
|
||||
start = time(NULL);
|
||||
if (memcmp(hashcode, hashref, sizeof(hashref)))
|
||||
{
|
||||
printf("Error RipeMD-160!\n");
|
||||
printf("Hash expected: ");
|
||||
for (i=0; i<sizeof(hashref); i++)
|
||||
printf("%2.2X", hashref[i]);
|
||||
|
||||
printf("\n");
|
||||
printf("Hash computed: ");
|
||||
for (i=0; i<sizeof(hashref); i++)
|
||||
printf("%2.2X", hashcode[i]);
|
||||
|
||||
printf("\n");
|
||||
return 1;
|
||||
}
|
||||
if (start >= stop)
|
||||
{
|
||||
for (i=0; i<RMDsize/8; i++)
|
||||
for (i=0; i<sizeof(hashref); i++)
|
||||
printf("%2.2X", hashcode[i]);
|
||||
printf("\n%d Hashes/s of %d Mbit message => %d Mbit/s\n\n", cnt, MSG_SIZE/(1024*1024), cnt*MSG_SIZE/(1024*1024));
|
||||
start = clock();
|
||||
stop = start + 1000;
|
||||
start = time(NULL);
|
||||
stop = start + 1;
|
||||
cnt = 0;
|
||||
}
|
||||
cnt++;
|
||||
|
||||
Reference in New Issue
Block a user