Simple C rewrite that generates the right session IDs