teknoraver icon

strfry

teknoraver | PRO | 07/18/25 10:17:08 AM UTC (Edited) | 0 ⭐ | 13908 👁️ | Never ⏰ | []
C |

370 B

|

None

|

0 👍

/

0 👎

#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdint.h>
 
uint32_t djb2(const char *str)
{
    uint32_t hash = 5381;
    int c;
 
    while ((c = *str++))
        hash = hash * 33 + c;
 
    return hash;
}
 
int main(void)
{
    char s[] = "codroipo ";
 
    while (djb2(s) != 0xd07f3c4 && djb2(s) != 0x8f62f044) {
        strfry(s);
        puts(s);
    }
 
    return 0;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎