www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/22/05:00:29

From: "Filip Sielimowicz" <sielim AT wp DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: MD5 hash (or something like it)?
Date: Mon, 22 Jul 2002 10:06:03 +0200
Organization: ASK NorthPark http://www.npnet.org
Lines: 34
Message-ID: <ahgekf$trp$1@wulkan.npnet.org>
References: <VLN_8.25231$v53 DOT 1256490 AT news3 DOT calgary DOT shaw DOT ca> <ahge4o$t56$1 AT wulkan DOT npnet DOT org>
NNTP-Posting-Host: inthands2.hands.com.pl
X-Trace: wulkan.npnet.org 1027325393 30585 213.195.166.210 (22 Jul 2002 08:09:53 GMT)
X-Complaints-To: usenet AT npnet DOT org
NNTP-Posting-Date: Mon, 22 Jul 2002 08:09:53 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> > Does anyone know a quick way of generating an MD5 hash (or something
> > similar..  some sort of checksum) for a string?  Been looking around on
> the
> > net, but not finding a lot ..
> >
>
> Really ?
> http://www.google.com.pl/search?q=md5sum&ie=ISO-8859-2&hl=pl
>
> If you want some sources just look for files md5sum.c:
>
> http://www.google.com.pl/search?hl=pl&inlang=pl&ie=ISO-8859-2&q=md5sum.c
>


But if you want only some simple checksum for the string use just bitwise
xor function(operator)
or just adding with +:

char* mystring="blebleble";
char checksum=0;
int i;
for (i=0;i<strlen(mystring);i++)
 checksum=checksum^mystring[i];

(im not sure if there's ^= operator, may be "checksum^=mystring[i] is
enough)


elim
----



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019