<div dir="ltr">Maybe just obfuscate the presentation by turning it into hex, with a prefix or suffix, so you can convert it back and forth?<br><br>So it looks like this: 8ab4 87ad cf54<br><br>But that limits what it can grow too ...<br>
<br><div class="gmail_quote">On Sun, Jan 2, 2011 at 9:25 PM, Joe Wennechuk <span dir="ltr"><<a href="mailto:youcanreachmehere@hotmail.com">youcanreachmehere@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
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...<br>
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.<br>
<br><br>I think I'm over thinking this maybe??<br>Joseph Wennechuk<br>
________________<br><br><br><br><br><hr>Date: Sun, 2 Jan 2011 20:45:38 +0200<br>From: <a href="mailto:kb@2bits.com" target="_blank">kb@2bits.com</a><div class="im"><br>To: <a href="mailto:kwlug-disc@kwlug.org" target="_blank">kwlug-disc@kwlug.org</a><br>
Subject: Re: [kwlug-disc] Hash functions.<br><br></div><div><div></div><div class="h5"><div dir="ltr">You just need to generate a quasi-unique number from a set of variables.<br><br>$ php -a<br>php > $string = "Something or other with date and time";<br>
php > $hash = md5($string);<br>php > print $hash;<br>
6d1740d6c0c59422b052916acb8ad778<br><br clear="all">Stuff what you want in $string, be it the store, date, whatever.<br><br>Then you can use the $hash value as the key in the database to track<br>this coupon.<br><br>All this would have worked if you have not said it should be short.<br>
<br>But you want it to be short, so the above may be too long.<br><br>Would this work? It is based on the microsecond time. If you<br>have a transaction every few seconds, then it should be OK.<br>Clashes can happen if you have two at the same exact micro-<br>
second.<br><br>$ php -a<br>php > print uniqid();<br>4d20c753e4001<br><br>Short enough?<br><br>Another approach: why not use an autoincrement key in the database table <br>that is the primary key for the coupon table, and be done with it? The<br>
rest of the data can be cross indexed in that table (store ID, date,<br>time, description, ...etc.). It will be just a number.<br>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>
<a href="http://2bits.com" target="_blank">http://2bits.com</a><br>
Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>
</div>
<br></div></div>_______________________________________________
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a> mailing list
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a>@<a href="http://kwlug.org" target="_blank">kwlug.org</a>
<a href="http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org" target="_blank">http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org</a> </div>
<br>_______________________________________________<br>
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a> mailing list<br>
<a href="http://kwlug-disc_kwlug.org" target="_blank">kwlug-disc_kwlug.org</a>@<a href="http://kwlug.org" target="_blank">kwlug.org</a><br>
<a href="http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org" target="_blank">http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.<br>
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>
</div>