Skip to content

Instantly share code, notes, and snippets.

@darccio
darccio / pearson-hashing.c
Last active December 10, 2025 03:00
Pearson hashing (just for fun). Includes Ruby and Golang versions for RFC 3074 and original variants.
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
/*
* Pearson hashing (from Wikipedia)
*
* Pearson hashing is a hash function designed for fast execution on processors with 8-bit registers.
* Given an input consisting of any number of bytes, it produces as output a single byte that is strongly
* dependent on every byte of the input. Its implementation requires only a few instructions, plus a
@lasarus
lasarus / ascii-raycasting.c
Created August 25, 2012 17:40
ASCII Raycasting
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <math.h>
int quit = 0;
/*int screen_width = 640, screen_height = 480, screen_bpp = 32;*/
int screen_width = 1280, screen_height = 720, screen_bpp = 32;
int char_width = 8, char_height = 12;
int text_width = 80;