[kwlug-disc] Hash functions.
Khalid Baheyeldin
kb at 2bits.com
Sun Jan 2 15:24:02 EST 2011
Maybe just obfuscate the presentation by turning it into hex, with a prefix
or suffix, so you can convert it back and forth?
So it looks like this: 8ab4 87ad cf54
But that limits what it can grow too ...
On Sun, Jan 2, 2011 at 9:25 PM, Joe Wennechuk <youcanreachmehere at hotmail.com
> wrote:
> That is the rub, the size... I think I need an auto increment, but I would
> still like to obfuscate it somewhat I dont want it to look sequential. Am I
> thinking wrong? I just want to appear secure for the moment, or at least
> make it hard. I'm sure most of the coupons would be honored with or without
> the actual presentation; at least, thats been my experience in the low item
> value realm, if the coupons were for like $200 off I could understand, but
> for now I'm focusing on just individuaizing(Uniqueness generated in real
> time) to track redemption mostly. Each coupon shoud for the moment be in the
> cents or low dollars. At least until I can do some more testing and see if I
> really get collisions. I'm not sure about the math...
> what is the least amount of (base n<127 bytes {no special characters
> please} )Some sms work on UTF-7 ???] that can represent 250 characters
> uniquely using time/date/message/fromID as inputs in 250 character blocks.
>
>
> I think I'm over thinking this maybe??
> Joseph Wennechuk
> ________________
>
>
>
>
> ------------------------------
> Date: Sun, 2 Jan 2011 20:45:38 +0200
> From: kb at 2bits.com
>
> To: kwlug-disc at kwlug.org
> Subject: Re: [kwlug-disc] Hash functions.
>
> You just need to generate a quasi-unique number from a set of variables.
>
> $ php -a
> php > $string = "Something or other with date and time";
> php > $hash = md5($string);
> php > print $hash;
> 6d1740d6c0c59422b052916acb8ad778
>
> Stuff what you want in $string, be it the store, date, whatever.
>
> Then you can use the $hash value as the key in the database to track
> this coupon.
>
> All this would have worked if you have not said it should be short.
>
> But you want it to be short, so the above may be too long.
>
> Would this work? It is based on the microsecond time. If you
> have a transaction every few seconds, then it should be OK.
> Clashes can happen if you have two at the same exact micro-
> second.
>
> $ php -a
> php > print uniqid();
> 4d20c753e4001
>
> Short enough?
>
> Another approach: why not use an autoincrement key in the database table
> that is the primary key for the coupon table, and be done with it? The
> rest of the data can be cross indexed in that table (store ID, date,
> time, description, ...etc.). It will be just a number.
> --
> Khalid M. Baheyeldin
> 2bits.com, Inc.
> http://2bits.com
> Drupal optimization, development, customization and consulting.
> Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
> Simplicity is the ultimate sophistication. -- Leonardo da Vinci
>
> _______________________________________________ kwlug-disc_kwlug.orgmailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
>
> _______________________________________________
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
>
>
--
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20110102/2b584e21/attachment.htm>
More information about the kwlug-disc
mailing list