Jump to content

l0ve2hat3

Members
  • Posts

    312
  • Joined

  • Last visited

    Never

Everything posted by l0ve2hat3

  1. I need to make a manual for a PHP application I developed. Is there any good open source php applications to create and manage the manual in?
  2. this is a comment on http://php.net/manual/en/function.hash-hmac.php HOTP Algorithm that works according to the RCF http://tools.ietf.org/html/draft-mraihi-oath-hmac-otp-04 The test cases from the RCF document the ASCII string as "123456787901234567890". But the hex decoded to a string is "12345678901234567890". Secret="12345678901234567890"; Count: 0 755224 1 287082 <?php function oath_hotp($key,$counter) { // Convert to padded binary string $data = pack ('C*', $counter); $data = str_pad($data,8,chr(0),STR_PAD_LEFT); // HMAC return hash_hmac('sha1',$data,$key); } function oath_truncate($hash, $length = 6) { // Convert to dec foreach(str_split($hash,2) as $hex) { $hmac_result[]=hexdec($hex); } // Find offset $offset = $hmac_result[19] & 0xf; // Algorithm from RFC return ( (($hmac_result[$offset+0] & 0x7f) << 24 ) | (($hmac_result[$offset+1] & 0xff) << 16 ) | (($hmac_result[$offset+2] & 0xff) << 8 ) | ($hmac_result[$offset+3] & 0xff) ) % pow(10,$length); } print "<pre>"; print "Compare results with:" print " http://tools.ietf.org/html/draft-mraihi-oath-hmac-otp-04\n"; print "Count\tHash\t\t\t\t\t\tPin\n"; for($i=0;$i<10;$i++) print $i."\t".($a=oath_hotp("12345678901234567890",$i)) print "\t".oath_truncate($a)."\n"; How do they get "123456787901234567890" from "12345678901234567890"??
  3. im retarded...
  4. <?php $collection_date=1258434000; $closing_date=1273172751; for($date_posted=$collection_date;$date_posted<$closing_date;$date_posted=strtotime(date('m/d/Y',$date_posted)." +1 day")){ echo date('m/d/y',$date_posted)."<br>"; } ?> OUTPUT 11/17/09 11/18/09 11/19/09 11/20/09 11/21/09 11/22/09 11/23/09 11/24/09 11/25/09 11/26/09 11/27/09 11/28/09 11/29/09 11/30/09 12/01/09 12/02/09 etc... WHY IS IT SKIPPING THE 31st??
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.