bluehorizons

Hash tables :D 2.0

Jun 3rd, 2026 (edited)
103
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.99 KB | None | 0 0
  1. // hash_table.h VV
  2.  
  3. #ifndef HASH_TABLE_H
  4. #define HASH_TABLE_H
  5.  
  6. #include <stdbool.h>
  7.  
  8. #ifndef HASH_MODULUS // Allowing you to define your own hash modulus...
  9. // Except that it only works on the header, probably breaking if you set it. Needs a fix there.
  10. #define HASH_MODULUS 256
  11. #endif
  12.  
  13. struct hash_bucket_t {
  14.     bool owns_key;
  15.     bool owns_value;
  16.     void* key;
  17.     void* value;
  18.     struct hash_bucket_t* next; // Links directly to next bucket there
  19. };
  20.  
  21. struct hash_table_t {
  22.     struct hash_bucket_t buckets[HASH_MODULUS];
  23.     unsigned int (*hash_function)(void*);
  24.     bool (*equals_function)(void*,void*);
  25. };
  26.  
  27. struct optional_t {
  28.     bool is_present;
  29.     void* value;
  30. };
  31.  
  32. struct optional_t get_value_from_hash_table(struct hash_table_t table, void* key);
  33.  
  34. void put_value_in_hash_table(struct hash_table_t* table, void* key, void* value, bool table_owns_key, bool table_owns_value);
  35.  
  36. void free_hash_table(struct hash_table_t table); // PLEASE call after
  37.  
  38. #endif
  39. // hash_table.c VV
  40.  
  41. #include <stdlib.h>
  42. #include "hash_table.h"
  43.  
  44. struct optional_t get_value_from_hash_table(struct hash_table_t table, void* key) {
  45.     unsigned int hash = table.hash_function(key);
  46.  
  47.     unsigned int hash_modulo_result = hash % HASH_MODULUS;
  48.    
  49.     struct hash_bucket_t search_point = table.buckets[hash_modulo_result];
  50.    
  51.     bool found = false;
  52.     struct optional_t result;
  53.     result.is_present = false;
  54.     result.value = NULL;
  55.  
  56.     if (search_point.key == NULL) {
  57.         return result; // Not found
  58.     }
  59.  
  60.     while (!found) {
  61.         if (table.equals_function(key, search_point.key)) {
  62.             result.value = search_point.value;
  63.             result.is_present = true;
  64.             found = true;
  65.         } else {
  66.             if (search_point.next == NULL) {
  67.                 found = true;
  68.             } else {
  69.                 search_point = (*search_point.next);
  70.             }
  71.         }
  72.     }
  73.  
  74.     return result;
  75. }
  76.  
  77. /** NOTE You are expected to free your keys yourself. Values can be handled automatically */
  78. void put_value_in_hash_table(struct hash_table_t* table, void* key, void* value, bool table_owns_key, bool table_owns_value) {
  79.     unsigned int hash = table->hash_function(key);
  80.  
  81.     unsigned int hash_modulo_result = hash % HASH_MODULUS;
  82.  
  83.     struct hash_bucket_t* placement_point = &table->buckets[hash_modulo_result];
  84.  
  85.     while (placement_point->key != NULL) {
  86.         if (placement_point->next == NULL) {
  87.             placement_point->next = (struct hash_bucket_t*)malloc(sizeof(struct hash_bucket_t));
  88.         }
  89.         placement_point = placement_point->next;
  90.     }
  91.     placement_point->key = key;
  92.     placement_point->value = value;
  93.     placement_point->owns_key = table_owns_key;
  94.     placement_point->owns_value = table_owns_value;
  95. }
  96.  
  97. static void recursive_bucket_free(struct hash_bucket_t bucket) {
  98.     if (bucket.next != NULL) {
  99.         recursive_bucket_free(*(bucket.next));
  100.     }
  101.     if (bucket.owns_value) {
  102.         free(bucket.value);
  103.     }
  104.     if (bucket.owns_key) {
  105.         free(bucket.key);
  106.     }
  107.     if (bucket.next != NULL) {
  108.         free(bucket.next);
  109.     }
  110. }
  111.  
  112. void free_hash_table(struct hash_table_t table) {
  113.     for (int i = 0; i < HASH_MODULUS; i++) {
  114.         recursive_bucket_free(table.buckets[i]);
  115.     }
  116. }
  117.  
Advertisement
Comments
  • User was banned
  • User was banned
  • # CSS 0.83 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://drive.google.com/file/d/1cvQPOZ7JecI0L6lqdIzIHJbHQBiDRT4U/view?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
Add Comment
Please, Sign In to add comment