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