<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Yes.. thank you CRC is exactly what I'm looking for.<br><br>Joseph Wennechuk<br>
________________<br><br><br><br><br>> Date: Sun, 2 Jan 2011 11:08:39 -0500<br>> From: 3lucid@gmail.com<br>> To: kwlug-disc@kwlug.org<br>> Subject: Re: [kwlug-disc] Hash functions.<br>> <br>> On Sun, Jan 2, 2011 at 10:59 AM, Khalid Baheyeldin <kb@2bits.com> wrote:<br>> > On Sun, Jan 2, 2011 at 5:46 PM, Joe Wennechuk<br>> > <youcanreachmehere@hotmail.com> wrote:<br>> >><br>> >> I want to use a hash type function to generate a unique id for sms<br>> >> messages. I want the smallest possible number of bytes returned as the<br>> >> identifier, I can use all alnum, and even symbols maybe only ASCII up to<br>> >> 127, instead of 256. The input is going to be only 120 chrs+DateTime()+maybe<br>> >> some 10 digit identifier or something, so maybe 200-250 chrs max. for the<br>> >> input, and hopefully like 4-5 chrs for the output with collisions less than<br>> >> 1 in 500,000,000 or so (127^5 is like 33,000,000,000 so that seems<br>> >> ok???).... Is there a function to do this? All the ones I seem to see output<br>> >> in binary or hex only I think I could really reduce the size by using 127<br>> >> chars instaed of 16, and bites are critical to the app. I suppose I could do<br>> >> some parsing on the binary number and come up with something, but I rater<br>> >> just be done with it.<br>> ><br>> > It is unclear to me if you say hex is acceptable or not.<br>> ><br>> > If all you need is a unique hash from a string (however you generate it is<br>> > irrelevant), then a 32 character hash with hex values can be done using<br>> > md5().<br>> ><br>> > $your_hash = md5($your_string);<br>> ><br>> > http://php.net/manual/en/function.md5.php<br>> <br>> Yes, it sounds to me like you just want a cryptographic hash, then<br>> run the hash value through a base-64 encoder to get an alphanumeric<br>> value rather than a hexadecimal value.<br>> <br>> Alternatively, if security isn't your goal, you could use a CRC, which<br>> should give a smaller output value than MD5 or SHA1.<br>> <br>> _______________________________________________<br>> kwlug-disc_kwlug.org mailing list<br>> kwlug-disc_kwlug.org@kwlug.org<br>> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org<br> </body>
</html>