#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <io.h>
#include <fcntl.h>
#include <dos.h>
#include <string.h>

// 18 tabellen
char lijst1[]= {0x36,0x38,0x36,0x39,0x36,0x41,0x36,0x42,0x36,0x43,0x36,0x44,0x36,
		0x45,0x36,0x46,0x36,0x30,0x36,0x31,0x36,0x32,0x36,0x33,0x36,0x34,
		0x36,0x35,0x36,0x36,0x36,0x37,0x37,0x38,0x37,0x39,0x37,0x41,0x37,
		0x42,0x37,0x43,0x37,0x44,0x37,0x45,0x37,0x46,0x37,0x30,0x37,0x31,
		0x37,0x32,0x37,0x33,0x37,0x34,0x37,0x35,0x37,0x36,0x37,0x37,0x30,
		0x38,0x30,0x39,0x30,0x41,0x30,0x42,0x30,0x43,0x30,0x44,0x30,0x45,
		0x30,0x46,0x30,0x30,0x30,0x31,0x30,0x32,0x30,0x33,0x30,0x34,0x30,
		0x35,0x30,0x36,0x30,0x37,0x31,0x38,0x31,0x39,0x31,0x41,0x31,0x42,
                0x31,0x43,0x31,0x44,0x31,0x45,0x31,0x46,0x31,0x30,0x31,0x31,0x31,
		0x32,0x31,0x33,0x31,0x34,0x31,0x35,0x31,0x36,0x31,0x37,0x32,0x38,
                0x30,0x39,0x30,0x41,0x30,0x42,0x30,0x43,0x30,0x44,0x30,0x45,0x30,
                0x46,0x30,0x30,0x30,0x31,0x30,0x32,0x30,0x33,0x30,0x34,0x30,0x35,
                0x30,0x36,0x30,0x37,0x31,0x38,0x31,0x39,0x31,0x41,0x31,0x42,0x31,
                0x43,0x31,0x44,0x31,0x45,0x31,0x46,0x31,0x30,0x31,0x31,0x31,0x32,
                0x33,0x33,0x33,0x34,0x33,0x35,0x33,0x36};
char lijst2[]= {0x43,0x45,0x43,0x46,0x43,0x43,0x43,0x44,0x43,0x41,0x43,0x42,0x43,
                0x38,0x43,0x39,0x43,0x36,0x43,0x37,0x43,0x34,0x43,0x35,0x43,0x32,
                0x43,0x33,0x43,0x30,0x43,0x31,0x44,0x45,0x44,0x46,0x44,0x43,0x44,
                0x44,0x44,0x41,0x44,0x42,0x44,0x38,0x44,0x39,0x44,0x36,0x44,0x37,
                0x44,0x34,0x44,0x35,0x44,0x32,0x44,0x33,0x44,0x30,0x44,0x31,0x41,
                0x45,0x41,0x46,0x41,0x43,0x41,0x44,0x41,0x41,0x41,0x42,0x41,0x38,
                0x41,0x39,0x41,0x36,0x41,0x37,0x41,0x34,0x41,0x35,0x41,0x32,0x41,
		0x33,0x41,0x30,0x41,0x31,0x42,0x45,0x42,0x46,0x42,0x43,0x42,0x44,
                0x42,0x41,0x42,0x42,0x42,0x38,0x42,0x39,0x42,0x36,0x42,0x37,0x42,
                0x34,0x42,0x35,0x42,0x32,0x42,0x33,0x42,0x30,0x42,0x31,0x38,0x45,
		0x41,0x46,0x41,0x43,0x41,0x44,0x41,0x41,0x41,0x42,0x41,0x38,0x41,
		0x39,0x41,0x36,0x41,0x37,0x41,0x34,0x41,0x35,0x41,0x32,0x41,0x33,
                0x41,0x30,0x41,0x31,0x42,0x45,0x42,0x46,0x42,0x43,0x42,0x44,0x42,
                0x41,0x42,0x42,0x42,0x38,0x42,0x39,0x42,0x36,0x42,0x37,0x42,0x34,
                0x39,0x35,0x39,0x32,0x39,0x33,0x39,0x30};
char lijst3[]= {0x35,0x36,0x35,0x37,0x35,0x34,0x35,0x35,0x35,0x32,0x35,0x33,0x35,
                0x30,0x35,0x31,0x35,0x45,0x35,0x46,0x35,0x43,0x35,0x44,0x35,0x41,
                0x35,0x42,0x35,0x38,0x35,0x39,0x34,0x36,0x34,0x37,0x34,0x34,0x34,
                0x35,0x34,0x32,0x34,0x33,0x34,0x30,0x34,0x31,0x34,0x45,0x34,0x46,
		0x34,0x43,0x34,0x44,0x34,0x41,0x34,0x42,0x34,0x38,0x34,0x39,0x33,
                0x36,0x33,0x37,0x33,0x34,0x33,0x35,0x33,0x32,0x33,0x33,0x33,0x30,
                0x33,0x31,0x33,0x45,0x33,0x46,0x33,0x43,0x33,0x44,0x33,0x41,0x33,
                0x42,0x33,0x38,0x33,0x39,0x32,0x36,0x32,0x37,0x32,0x34,0x32,0x35,
		0x32,0x32,0x32,0x33,0x32,0x30,0x32,0x31,0x32,0x45,0x32,0x46,0x32,
                0x43,0x32,0x44,0x32,0x41,0x32,0x42,0x32,0x38,0x32,0x39,0x31,0x36,
		0x33,0x37,0x33,0x34,0x33,0x35,0x33,0x32,0x33,0x33,0x33,0x30,0x33,
                0x31,0x33,0x45,0x33,0x46,0x33,0x43,0x33,0x44,0x33,0x41,0x33,0x42,
		0x33,0x38,0x33,0x39,0x32,0x36,0x32,0x37,0x32,0x34,0x32,0x35,0x32,
                0x32,0x32,0x33,0x32,0x30,0x32,0x31,0x32,0x45,0x32,0x46,0x32,0x43,
                0x30,0x44,0x30,0x41,0x30,0x42,0x30,0x38};
char lijst4[]= {0x33,0x44,0x33,0x43,0x33,0x46,0x33,0x45,0x33,0x39,0x33,0x38,0x33,
                0x42,0x33,0x41,0x33,0x35,0x33,0x34,0x33,0x37,0x33,0x36,0x33,0x31,
                0x33,0x30,0x33,0x33,0x33,0x32,0x32,0x44,0x32,0x43,0x32,0x46,0x32,
                0x45,0x32,0x39,0x32,0x38,0x32,0x42,0x32,0x41,0x32,0x35,0x32,0x34,
                0x32,0x37,0x32,0x36,0x32,0x31,0x32,0x30,0x32,0x33,0x32,0x32,0x35,
                0x44,0x35,0x43,0x35,0x46,0x35,0x45,0x35,0x39,0x35,0x38,0x35,0x42,
                0x35,0x41,0x35,0x35,0x35,0x34,0x35,0x37,0x35,0x36,0x35,0x31,0x35,
                0x30,0x35,0x33,0x35,0x32,0x34,0x44,0x34,0x43,0x34,0x46,0x34,0x45,
                0x34,0x39,0x34,0x38,0x34,0x42,0x34,0x41,0x34,0x35,0x34,0x34,0x34,
                0x37,0x34,0x36,0x34,0x31,0x34,0x30,0x34,0x33,0x34,0x32,0x37,0x44,
                0x35,0x43,0x35,0x46,0x35,0x45,0x35,0x39,0x35,0x38,0x35,0x42,0x35,
                0x41,0x35,0x35,0x35,0x34,0x35,0x37,0x35,0x36,0x35,0x31,0x35,0x30,
		0x35,0x33,0x35,0x32,0x34,0x44,0x34,0x43,0x34,0x46,0x34,0x45,0x34,
                0x39,0x34,0x38,0x34,0x42,0x34,0x41,0x34,0x35,0x34,0x34,0x34,0x37,
                0x36,0x36,0x36,0x31,0x36,0x30,0x36,0x33};
char lijst5[]= {0x34,0x37,0x34,0x36,0x34,0x35,0x34,0x34,0x34,0x33,0x34,0x32,0x34,
		0x31,0x34,0x30,0x34,0x46,0x34,0x45,0x34,0x44,0x34,0x43,0x34,0x42,
                0x34,0x41,0x34,0x39,0x34,0x38,0x35,0x37,0x35,0x36,0x35,0x35,0x35,
                0x34,0x35,0x33,0x35,0x32,0x35,0x31,0x35,0x30,0x35,0x46,0x35,0x45,
                0x35,0x44,0x35,0x43,0x35,0x42,0x35,0x41,0x35,0x39,0x35,0x38,0x32,
                0x37,0x32,0x36,0x32,0x35,0x32,0x34,0x32,0x33,0x32,0x32,0x32,0x31,
                0x32,0x30,0x32,0x46,0x32,0x45,0x32,0x44,0x32,0x43,0x32,0x42,0x32,
                0x41,0x32,0x39,0x32,0x38,0x33,0x37,0x33,0x36,0x33,0x35,0x33,0x34,
                0x33,0x33,0x33,0x32,0x33,0x31,0x33,0x30,0x33,0x46,0x33,0x45,0x33,
		0x44,0x33,0x43,0x33,0x42,0x33,0x41,0x33,0x39,0x33,0x38,0x30,0x37,
                0x32,0x36,0x32,0x35,0x32,0x34,0x32,0x33,0x32,0x32,0x32,0x31,0x32,
		0x30,0x32,0x46,0x32,0x45,0x32,0x44,0x32,0x43,0x32,0x42,0x32,0x41,
                0x32,0x39,0x32,0x38,0x33,0x37,0x33,0x36,0x33,0x35,0x33,0x34,0x33,
		0x33,0x33,0x32,0x33,0x31,0x33,0x30,0x33,0x46,0x33,0x45,0x33,0x44,
                0x31,0x43,0x31,0x42,0x31,0x41,0x31,0x39};
char lijst6[]= {0x34,0x39,0x34,0x38,0x34,0x42,0x34,0x41,0x34,0x44,0x34,0x43,0x34,
                0x46,0x34,0x45,0x34,0x31,0x34,0x30,0x34,0x33,0x34,0x32,0x34,0x35,
		0x34,0x34,0x34,0x37,0x34,0x36,0x35,0x39,0x35,0x38,0x35,0x42,0x35,
                0x41,0x35,0x44,0x35,0x43,0x35,0x46,0x35,0x45,0x35,0x31,0x35,0x30,
                0x35,0x33,0x35,0x32,0x35,0x35,0x35,0x34,0x35,0x37,0x35,0x36,0x32,
                0x39,0x32,0x38,0x32,0x42,0x32,0x41,0x32,0x44,0x32,0x43,0x32,0x46,
                0x32,0x45,0x32,0x31,0x32,0x30,0x32,0x33,0x32,0x32,0x32,0x35,0x32,
                0x34,0x32,0x37,0x32,0x36,0x33,0x39,0x33,0x38,0x33,0x42,0x33,0x41,
                0x33,0x44,0x33,0x43,0x33,0x46,0x33,0x45,0x33,0x31,0x33,0x30,0x33,
                0x33,0x33,0x32,0x33,0x35,0x33,0x34,0x33,0x37,0x33,0x36,0x30,0x39,
		0x32,0x38,0x32,0x42,0x32,0x41,0x32,0x44,0x32,0x43,0x32,0x46,0x32,
                0x45,0x32,0x31,0x32,0x30,0x32,0x33,0x32,0x32,0x32,0x35,0x32,0x34,
                0x32,0x37,0x32,0x36,0x33,0x39,0x33,0x38,0x33,0x42,0x33,0x41,0x33,
                0x44,0x33,0x43,0x33,0x46,0x33,0x45,0x33,0x31,0x33,0x30,0x33,0x33,
                0x31,0x32,0x31,0x35,0x31,0x34,0x31,0x37};
char lijst7[]= {0x38,0x31,0x38,0x30,0x38,0x33,0x38,0x32,0x38,0x35,0x38,0x34,0x38,
                0x37,0x38,0x36,0x38,0x39,0x38,0x38,0x38,0x42,0x38,0x41,0x38,0x44,
		0x38,0x43,0x38,0x46,0x38,0x45,0x39,0x31,0x39,0x30,0x39,0x33,0x39,
                0x32,0x39,0x35,0x39,0x34,0x39,0x37,0x39,0x36,0x39,0x39,0x39,0x38,
                0x39,0x42,0x39,0x41,0x39,0x44,0x39,0x43,0x39,0x46,0x39,0x45,0x45,
		0x31,0x45,0x30,0x45,0x33,0x45,0x32,0x45,0x35,0x45,0x34,0x45,0x37,
		0x45,0x36,0x45,0x39,0x45,0x38,0x45,0x42,0x45,0x41,0x45,0x44,0x45,
                0x43,0x45,0x46,0x45,0x45,0x46,0x31,0x46,0x30,0x46,0x33,0x46,0x32,
                0x46,0x35,0x46,0x34,0x46,0x37,0x46,0x36,0x46,0x39,0x46,0x38,0x46,
                0x42,0x46,0x41,0x46,0x44,0x46,0x43,0x46,0x46,0x46,0x45,0x43,0x31,
                0x45,0x30,0x45,0x33,0x45,0x32,0x45,0x35,0x45,0x34,0x45,0x37,0x45,
                0x36,0x45,0x39,0x45,0x38,0x45,0x42,0x45,0x41,0x45,0x44,0x45,0x43,
                0x45,0x46,0x45,0x45,0x46,0x31,0x46,0x30,0x46,0x33,0x46,0x32,0x46,
                0x35,0x46,0x34,0x46,0x37,0x46,0x36,0x46,0x39,0x46,0x38,0x46,0x42,
		0x44,0x41,0x44,0x44,0x44,0x43,0x44,0x46};
char lijst8[]= {0x33,0x42,0x33,0x41,0x33,0x39,0x33,0x38,0x33,0x46,0x33,0x45,0x33,
                0x44,0x33,0x43,0x33,0x33,0x33,0x32,0x33,0x31,0x33,0x30,0x33,0x37,
                0x33,0x36,0x33,0x35,0x33,0x34,0x32,0x42,0x32,0x41,0x32,0x39,0x32,
		0x38,0x32,0x46,0x32,0x45,0x32,0x44,0x32,0x43,0x32,0x33,0x32,0x32,
                0x32,0x31,0x32,0x30,0x32,0x37,0x32,0x36,0x32,0x35,0x32,0x34,0x35,
                0x42,0x35,0x41,0x35,0x39,0x35,0x38,0x35,0x46,0x35,0x45,0x35,0x44,
                0x35,0x43,0x35,0x33,0x35,0x32,0x35,0x31,0x35,0x30,0x35,0x37,0x35,
		0x36,0x35,0x35,0x35,0x34,0x34,0x42,0x34,0x41,0x34,0x39,0x34,0x38,
                0x34,0x46,0x34,0x45,0x34,0x44,0x34,0x43,0x34,0x33,0x34,0x32,0x34,
                0x31,0x34,0x30,0x34,0x37,0x34,0x36,0x34,0x35,0x34,0x34,0x37,0x42,
                0x35,0x41,0x35,0x39,0x35,0x38,0x35,0x46,0x35,0x45,0x35,0x44,0x35,
		0x43,0x35,0x33,0x35,0x32,0x35,0x31,0x35,0x30,0x35,0x37,0x35,0x36,
                0x35,0x35,0x35,0x34,0x34,0x42,0x34,0x41,0x34,0x39,0x34,0x38,0x34,
                0x46,0x34,0x45,0x34,0x44,0x34,0x43,0x34,0x33,0x34,0x32,0x34,0x31,
                0x36,0x30,0x36,0x37,0x36,0x36,0x36,0x35};
char lijst9[]= {0x35,0x41,0x35,0x42,0x35,0x38,0x35,0x39,0x35,0x45,0x35,0x46,0x35,
                0x43,0x35,0x44,0x35,0x32,0x35,0x33,0x35,0x30,0x35,0x31,0x35,0x36,
                0x35,0x37,0x35,0x34,0x35,0x35,0x34,0x41,0x34,0x42,0x34,0x38,0x34,
                0x39,0x34,0x45,0x34,0x46,0x34,0x43,0x34,0x44,0x34,0x32,0x34,0x33,
                0x34,0x30,0x34,0x31,0x34,0x36,0x34,0x37,0x34,0x34,0x34,0x35,0x33,
                0x41,0x33,0x42,0x33,0x38,0x33,0x39,0x33,0x45,0x33,0x46,0x33,0x43,
                0x33,0x44,0x33,0x32,0x33,0x33,0x33,0x30,0x33,0x31,0x33,0x36,0x33,
		0x37,0x33,0x34,0x33,0x35,0x32,0x41,0x32,0x42,0x32,0x38,0x32,0x39,
                0x32,0x45,0x32,0x46,0x32,0x43,0x32,0x44,0x32,0x32,0x32,0x33,0x32,
                0x30,0x32,0x31,0x32,0x36,0x32,0x37,0x32,0x34,0x32,0x35,0x31,0x41,
		0x33,0x42,0x33,0x38,0x33,0x39,0x33,0x45,0x33,0x46,0x33,0x43,0x33,
		0x44,0x33,0x32,0x33,0x33,0x33,0x30,0x33,0x31,0x33,0x36,0x33,0x37,
                0x33,0x34,0x33,0x35,0x32,0x41,0x32,0x42,0x32,0x38,0x32,0x39,0x32,
                0x45,0x32,0x46,0x32,0x43,0x32,0x44,0x32,0x32,0x32,0x33,0x32,0x30,
                0x30,0x31,0x30,0x36,0x30,0x37,0x30,0x34};
char lijst10[]={0x41,0x43,0x41,0x44,0x41,0x45,0x41,0x46,0x41,0x38,0x41,0x39,0x41,
                0x41,0x41,0x42,0x41,0x34,0x41,0x35,0x41,0x36,0x41,0x37,0x41,0x30,
                0x41,0x31,0x41,0x32,0x41,0x33,0x42,0x43,0x42,0x44,0x42,0x45,0x42,
                0x46,0x42,0x38,0x42,0x39,0x42,0x41,0x42,0x42,0x42,0x34,0x42,0x35,
		0x42,0x36,0x42,0x37,0x42,0x30,0x42,0x31,0x42,0x32,0x42,0x33,0x43,
                0x43,0x43,0x44,0x43,0x45,0x43,0x46,0x43,0x38,0x43,0x39,0x43,0x41,
                0x43,0x42,0x43,0x34,0x43,0x35,0x43,0x36,0x43,0x37,0x43,0x30,0x43,
                0x31,0x43,0x32,0x43,0x33,0x44,0x43,0x44,0x44,0x44,0x45,0x44,0x46,
		0x44,0x38,0x44,0x39,0x44,0x41,0x44,0x42,0x44,0x34,0x44,0x35,0x44,
                0x36,0x44,0x37,0x44,0x30,0x44,0x31,0x44,0x32,0x44,0x33,0x45,0x43,
                0x43,0x44,0x43,0x45,0x43,0x46,0x43,0x38,0x43,0x39,0x43,0x41,0x43,
                0x42,0x43,0x34,0x43,0x35,0x43,0x36,0x43,0x37,0x43,0x30,0x43,0x31,
		0x43,0x32,0x43,0x33,0x44,0x43,0x44,0x44,0x44,0x45,0x44,0x46,0x44,
                0x38,0x44,0x39,0x44,0x41,0x44,0x42,0x44,0x34,0x44,0x35,0x44,0x36,
                0x46,0x37,0x46,0x30,0x46,0x31,0x46,0x32};
char lijst11[]={0x36,0x37,0x36,0x36,0x36,0x35,0x36,0x34,0x36,0x33,0x36,0x32,0x36,
                0x31,0x36,0x30,0x36,0x46,0x36,0x45,0x36,0x44,0x36,0x43,0x36,0x42,
                0x36,0x41,0x36,0x39,0x36,0x38,0x37,0x37,0x37,0x36,0x37,0x35,0x37,
                0x34,0x37,0x33,0x37,0x32,0x37,0x31,0x37,0x30,0x37,0x46,0x37,0x45,
                0x37,0x44,0x37,0x43,0x37,0x42,0x37,0x41,0x37,0x39,0x37,0x38,0x30,
                0x37,0x30,0x36,0x30,0x35,0x30,0x34,0x30,0x33,0x30,0x32,0x30,0x31,
                0x30,0x30,0x30,0x46,0x30,0x45,0x30,0x44,0x30,0x43,0x30,0x42,0x30,
                0x41,0x30,0x39,0x30,0x38,0x31,0x37,0x31,0x36,0x31,0x35,0x31,0x34,
                0x31,0x33,0x31,0x32,0x31,0x31,0x31,0x30,0x31,0x46,0x31,0x45,0x31,
                0x44,0x31,0x43,0x31,0x42,0x31,0x41,0x31,0x39,0x31,0x38,0x32,0x37,
                0x30,0x36,0x30,0x35,0x30,0x34,0x30,0x33,0x30,0x32,0x30,0x31,0x30,
		0x30,0x30,0x46,0x30,0x45,0x30,0x44,0x30,0x43,0x30,0x42,0x30,0x41,
		0x30,0x39,0x30,0x38,0x31,0x37,0x31,0x36,0x31,0x35,0x31,0x34,0x31,
                0x33,0x31,0x32,0x31,0x31,0x31,0x30,0x31,0x46,0x31,0x45,0x31,0x44,
                0x33,0x43,0x33,0x42,0x33,0x41,0x33,0x39};
char lijst12[]={0x44,0x38,0x44,0x39,0x44,0x41,0x44,0x42,0x44,0x43,0x44,0x44,0x44,
		0x45,0x44,0x46,0x44,0x30,0x44,0x31,0x44,0x32,0x44,0x33,0x44,0x34,
                0x44,0x35,0x44,0x36,0x44,0x37,0x43,0x38,0x43,0x39,0x43,0x41,0x43,
                0x42,0x43,0x43,0x43,0x44,0x43,0x45,0x43,0x46,0x43,0x30,0x43,0x31,
                0x43,0x32,0x43,0x33,0x43,0x34,0x43,0x35,0x43,0x36,0x43,0x37,0x42,
                0x38,0x42,0x39,0x42,0x41,0x42,0x42,0x42,0x43,0x42,0x44,0x42,0x45,
                0x42,0x46,0x42,0x30,0x42,0x31,0x42,0x32,0x42,0x33,0x42,0x34,0x42,
                0x35,0x42,0x36,0x42,0x37,0x41,0x38,0x41,0x39,0x41,0x41,0x41,0x42,
                0x41,0x43,0x41,0x44,0x41,0x45,0x41,0x46,0x41,0x30,0x41,0x31,0x41,
		0x32,0x41,0x33,0x41,0x34,0x41,0x35,0x41,0x36,0x41,0x37,0x39,0x38,
		0x42,0x39,0x42,0x41,0x42,0x42,0x42,0x43,0x42,0x44,0x42,0x45,0x42,
                0x46,0x42,0x30,0x42,0x31,0x42,0x32,0x42,0x33,0x42,0x34,0x42,0x35,
                0x42,0x36,0x42,0x37,0x41,0x38,0x41,0x39,0x41,0x41,0x41,0x42,0x41,
		0x43,0x41,0x44,0x41,0x45,0x41,0x46,0x41,0x30,0x41,0x31,0x41,0x32,
                0x38,0x33,0x38,0x34,0x38,0x35,0x38,0x36};
char lijst13[]={0x37,0x34,0x37,0x35,0x37,0x36,0x37,0x37,0x37,0x30,0x37,0x31,0x37,
                0x32,0x37,0x33,0x37,0x43,0x37,0x44,0x37,0x45,0x37,0x46,0x37,0x38,
		0x37,0x39,0x37,0x41,0x37,0x42,0x36,0x34,0x36,0x35,0x36,0x36,0x36,
                0x37,0x36,0x30,0x36,0x31,0x36,0x32,0x36,0x33,0x36,0x43,0x36,0x44,
                0x36,0x45,0x36,0x46,0x36,0x38,0x36,0x39,0x36,0x41,0x36,0x42,0x31,
                0x34,0x31,0x35,0x31,0x36,0x31,0x37,0x31,0x30,0x31,0x31,0x31,0x32,
                0x31,0x33,0x31,0x43,0x31,0x44,0x31,0x45,0x31,0x46,0x31,0x38,0x31,
                0x39,0x31,0x41,0x31,0x42,0x30,0x34,0x30,0x35,0x30,0x36,0x30,0x37,
                0x30,0x30,0x30,0x31,0x30,0x32,0x30,0x33,0x30,0x43,0x30,0x44,0x30,
                0x45,0x30,0x46,0x30,0x38,0x30,0x39,0x30,0x41,0x30,0x42,0x33,0x34,
                0x31,0x35,0x31,0x36,0x31,0x37,0x31,0x30,0x31,0x31,0x31,0x32,0x31,
                0x33,0x31,0x43,0x31,0x44,0x31,0x45,0x31,0x46,0x31,0x38,0x31,0x39,
                0x31,0x41,0x31,0x42,0x30,0x34,0x30,0x35,0x30,0x36,0x30,0x37,0x30,
                0x30,0x30,0x31,0x30,0x32,0x30,0x33,0x30,0x43,0x30,0x44,0x30,0x45,
                0x32,0x46,0x32,0x38,0x32,0x39,0x32,0x41};
char lijst14[]={0x42,0x35,0x42,0x34,0x42,0x37,0x42,0x36,0x42,0x31,0x42,0x30,0x42,
                0x33,0x42,0x32,0x42,0x44,0x42,0x43,0x42,0x46,0x42,0x45,0x42,0x39,
		0x42,0x38,0x42,0x42,0x42,0x41,0x41,0x35,0x41,0x34,0x41,0x37,0x41,
                0x36,0x41,0x31,0x41,0x30,0x41,0x33,0x41,0x32,0x41,0x44,0x41,0x43,
		0x41,0x46,0x41,0x45,0x41,0x39,0x41,0x38,0x41,0x42,0x41,0x41,0x44,
		0x35,0x44,0x34,0x44,0x37,0x44,0x36,0x44,0x31,0x44,0x30,0x44,0x33,
		0x44,0x32,0x44,0x44,0x44,0x43,0x44,0x46,0x44,0x45,0x44,0x39,0x44,
                0x38,0x44,0x42,0x44,0x41,0x43,0x35,0x43,0x34,0x43,0x37,0x43,0x36,
                0x43,0x31,0x43,0x30,0x43,0x33,0x43,0x32,0x43,0x44,0x43,0x43,0x43,
                0x46,0x43,0x45,0x43,0x39,0x43,0x38,0x43,0x42,0x43,0x41,0x46,0x35,
                0x44,0x34,0x44,0x37,0x44,0x36,0x44,0x31,0x44,0x30,0x44,0x33,0x44,
		0x32,0x44,0x44,0x44,0x43,0x44,0x46,0x44,0x45,0x44,0x39,0x44,0x38,
                0x44,0x42,0x44,0x41,0x43,0x35,0x43,0x34,0x43,0x37,0x43,0x36,0x43,
                0x31,0x43,0x30,0x43,0x33,0x43,0x32,0x43,0x44,0x43,0x43,0x43,0x46,
		0x45,0x45,0x45,0x39,0x45,0x38,0x45,0x42};
char lijst15[]={0x42,0x37,0x42,0x36,0x42,0x35,0x42,0x34,0x42,0x33,0x42,0x32,0x42,
                0x31,0x42,0x30,0x42,0x46,0x42,0x45,0x42,0x44,0x42,0x43,0x42,0x42,
                0x42,0x41,0x42,0x39,0x42,0x38,0x41,0x37,0x41,0x36,0x41,0x35,0x41,
		0x34,0x41,0x33,0x41,0x32,0x41,0x31,0x41,0x30,0x41,0x46,0x41,0x45,
                0x41,0x44,0x41,0x43,0x41,0x42,0x41,0x41,0x41,0x39,0x41,0x38,0x44,
                0x37,0x44,0x36,0x44,0x35,0x44,0x34,0x44,0x33,0x44,0x32,0x44,0x31,
                0x44,0x30,0x44,0x46,0x44,0x45,0x44,0x44,0x44,0x43,0x44,0x42,0x44,
		0x41,0x44,0x39,0x44,0x38,0x43,0x37,0x43,0x36,0x43,0x35,0x43,0x34,
                0x43,0x33,0x43,0x32,0x43,0x31,0x43,0x30,0x43,0x46,0x43,0x45,0x43,
                0x44,0x43,0x43,0x43,0x42,0x43,0x41,0x43,0x39,0x43,0x38,0x46,0x37,
		0x44,0x36,0x44,0x35,0x44,0x34,0x44,0x33,0x44,0x32,0x44,0x31,0x44,
                0x30,0x44,0x46,0x44,0x45,0x44,0x44,0x44,0x43,0x44,0x42,0x44,0x41,
                0x44,0x39,0x44,0x38,0x43,0x37,0x43,0x36,0x43,0x35,0x43,0x34,0x43,
		0x33,0x43,0x32,0x43,0x31,0x43,0x30,0x43,0x46,0x43,0x45,0x43,0x44,
                0x45,0x43,0x45,0x42,0x45,0x41,0x45,0x39};
char lijst16[]={0x37,0x46,0x37,0x45,0x37,0x44,0x37,0x43,0x37,0x42,0x37,0x41,0x37,
                0x39,0x37,0x38,0x37,0x37,0x37,0x36,0x37,0x35,0x37,0x34,0x37,0x33,
                0x37,0x32,0x37,0x31,0x37,0x30,0x36,0x46,0x36,0x45,0x36,0x44,0x36,
                0x43,0x36,0x42,0x36,0x41,0x36,0x39,0x36,0x38,0x36,0x37,0x36,0x36,
                0x36,0x35,0x36,0x34,0x36,0x33,0x36,0x32,0x36,0x31,0x36,0x30,0x31,
                0x46,0x31,0x45,0x31,0x44,0x31,0x43,0x31,0x42,0x31,0x41,0x31,0x39,
                0x31,0x38,0x31,0x37,0x31,0x36,0x31,0x35,0x31,0x34,0x31,0x33,0x31,
		0x32,0x31,0x31,0x31,0x30,0x30,0x46,0x30,0x45,0x30,0x44,0x30,0x43,
                0x30,0x42,0x30,0x41,0x30,0x39,0x30,0x38,0x30,0x37,0x30,0x36,0x30,
                0x35,0x30,0x34,0x30,0x33,0x30,0x32,0x30,0x31,0x30,0x30,0x33,0x46,
		0x31,0x45,0x31,0x44,0x31,0x43,0x31,0x42,0x31,0x41,0x31,0x39,0x31,
		0x38,0x31,0x37,0x31,0x36,0x31,0x35,0x31,0x34,0x31,0x33,0x31,0x32,
                0x31,0x31,0x31,0x30,0x30,0x46,0x30,0x45,0x30,0x44,0x30,0x43,0x30,
                0x42,0x30,0x41,0x30,0x39,0x30,0x38,0x30,0x37,0x30,0x36,0x30,0x35,
                0x32,0x34,0x32,0x33,0x32,0x32,0x32,0x31};
char lijst17[]={0x7d,0xd6,0x7d,0xd7,0x7d,0xaf,0x7d,0xac,0x7d,0xad,0x7d,0xaa,0x7d,
                0xab,0x7d,0xa8,0x7d,0xde,0x7d,0xdf,0x7d,0xdc,0x7d,0xdd,0x7d,0xda,
                0x7d,0xdb,0x7d,0xd8,0x7d,0xd9,0x7c,0xd6,0x7c,0xd7,0x7c,0xaf,0x7c,
                0xac,0x7c,0xad,0x7c,0xaa,0x7c,0xab,0x7c,0xa8,0x7c,0xde,0x7c,0xdf,
		0x7c,0xdc,0x7c,0xdd,0x7c,0xda,0x7c,0xdb,0x7c,0xd8,0x7c,0xd9,0x7b,
                0xd6,0x7b,0xd7,0x7b,0xaf,0x7b,0xac,0x7b,0xad,0x7b,0xaa,0x7b,0xab,
                0x7b,0xa8,0x7b,0xde,0x7b,0xdf,0x7b,0xdc,0x7b,0xdd,0x7b,0xda,0x7b,
                0xdb,0x7b,0xd8,0x7b,0xd9,0x7a,0xd6,0x7a,0xd7,0x7a,0xaf,0x7a,0xac,
		0x7a,0xad,0x7a,0xaa,0x7a,0xab,0x7a,0xa8,0x7a,0xde,0x7a,0xdf,0x7a,
                0xdc,0x7a,0xdd,0x7a,0xda,0x7a,0xdb,0x7a,0xd8,0x7a,0xd9,0x79,0xd6,
                0x7b,0xd7,0x7b,0xaf,0x7b,0xac,0x7b,0xad,0x7b,0xaa,0x7b,0xab,0x7b,
		0xa8,0x7b,0xde,0x7b,0xdf,0x7b,0xdc,0x7b,0xdd,0x7b,0xda,0x7b,0xdb,
		0x7b,0xd8,0x7b,0xd9,0x7a,0xd6,0x7a,0xd7,0x7a,0xaf,0x7a,0xac,0x7a,
                0xad,0x7a,0xaa,0x7a,0xab,0x7a,0xa8,0x7a,0xde,0x7a,0xdf,0x7a,0xdc,
                0x78,0xdd,0x78,0xda,0x78,0xdb,0x78,0xd8};
char lijst18[]={0x30,0x24,0x30,0x25,0x30,0x5f,0x30,0x5c,0x30,0x59,0x30,0x5e,0x30,
                0x5b,0x30,0x58,0x30,0x2c,0x30,0x2d,0x30,0x2e,0x30,0x2f,0x30,0x28,
                0x30,0x29,0x30,0x2a,0x30,0x2b,0x33,0x24,0x33,0x25,0x33,0x5f,0x33,
		0x5c,0x33,0x59,0x33,0x5e,0x33,0x5b,0x33,0x58,0x33,0x2c,0x33,0x2d,
                0x33,0x2e,0x33,0x2f,0x33,0x28,0x33,0x29,0x33,0x2a,0x33,0x2b,0x4f,
                0x24,0x4f,0x25,0x4f,0x5f,0x4f,0x5c,0x4f,0x59,0x4f,0x5e,0x4f,0x5b,
                0x4f,0x58,0x4f,0x2c,0x4f,0x2d,0x4f,0x2e,0x4f,0x2f,0x4f,0x28,0x4f,
                0x29,0x4f,0x2a,0x4f,0x2b,0x4e,0x24,0x4e,0x25,0x4e,0x5f,0x4e,0x5c,
                0x4e,0x59,0x4e,0x5e,0x4e,0x5b,0x4e,0x58,0x4e,0x2c,0x4e,0x2d,0x4e,
                0x2e,0x4e,0x2f,0x4e,0x28,0x4e,0x29,0x4e,0x2a,0x4e,0x2b,0x34,0x24,
		0x4f,0x25,0x4f,0x5f,0x4f,0x5c,0x4f,0x59,0x4f,0x5e,0x4f,0x5b,0x4f,
                0x58,0x4f,0x2c,0x4f,0x2d,0x4f,0x2e,0x4f,0x2f,0x4f,0x28,0x4f,0x29,
		0x4f,0x2a,0x4f,0x2b,0x4e,0x24,0x4e,0x25,0x4e,0x5f,0x4e,0x5c,0x4e,
		0x59,0x4e,0x5e,0x4e,0x5b,0x4e,0x58,0x4e,0x2c,0x4e,0x2d,0x4e,0x2e,
		0x37,0x2f,0x37,0x28,0x37,0x29,0x37,0x2a};



//eigenlijke decodeerroutine
char decode(char in1,char in2, int lijn)
{
   char lijst[190],terug;
   int counter,found=0;

   switch(lijn){
      case  1: for (counter=0;counter<190;counter++) lijst[counter]=lijst1[counter];break;
      case  2: for (counter=0;counter<190;counter++) lijst[counter]=lijst2[counter];break;
      case  3: for (counter=0;counter<190;counter++) lijst[counter]=lijst3[counter];break;
      case  4: for (counter=0;counter<190;counter++) lijst[counter]=lijst4[counter];break;
      case  5: for (counter=0;counter<190;counter++) lijst[counter]=lijst5[counter];break;
      case  6: for (counter=0;counter<190;counter++) lijst[counter]=lijst6[counter];break;
      case  7: for (counter=0;counter<190;counter++) lijst[counter]=lijst7[counter];break;
      case  8: for (counter=0;counter<190;counter++) lijst[counter]=lijst8[counter];break;
      case  9: for (counter=0;counter<190;counter++) lijst[counter]=lijst9[counter];break;
      case 10: for (counter=0;counter<190;counter++) lijst[counter]=lijst10[counter];break;
      case 11: for (counter=0;counter<190;counter++) lijst[counter]=lijst11[counter];break;
      case 12: for (counter=0;counter<190;counter++) lijst[counter]=lijst12[counter];break;
      case 13: for (counter=0;counter<190;counter++) lijst[counter]=lijst13[counter];break;
      case 14: for (counter=0;counter<190;counter++) lijst[counter]=lijst14[counter];break;
      case 15: for (counter=0;counter<190;counter++) lijst[counter]=lijst15[counter];break;
      case 16: for (counter=0;counter<190;counter++) lijst[counter]=lijst16[counter];break;
      case 17: for (counter=0;counter<190;counter++) lijst[counter]=lijst17[counter];break;
      case 18: for (counter=0;counter<190;counter++) lijst[counter]=lijst18[counter];break;
   }
   counter=31;
   do{
      counter++;
      if (in1==lijst[((counter-32)*2)])
	 if (in2==lijst[((counter-32)*2 +1)])
	    found=1;

   }while(counter<127 && found==0);
   terug=counter;

  return(terug);
}

int main(int argc, char *argv[])
{

   FILE *stream,*outf;
   char zin[16];
   char *compare="ScreenSave_Data",*winfile="c:\\windows\\user.dat";
   char huidigpw[38];
   char decoded[18],filenaam[200];
   char detect[4];
   char ch;
   int counter=0,bool=0,count=0,einde=0;
   int handle,export=0,odd=0,skipbagger=0;
   long filelth,meeloop;
   strcpy(zin,compare);

   textcolor(WHITE);
   cprintf("Windows 95/98 Screen Saver Password Decoder v1.0 - Coder : Xavier. '98 - klaphek\r\n");
   cprintf("様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様\r\n");
   textcolor(DARKGRAY);
   if (argc == 1){
      strcpy(filenaam,winfile);
      cprintf("No commandline parameters. Taking %s\r\n",filenaam);
   } else {
      strcpy(filenaam,argv[1]);
      cprintf("Filename in commandline. Taking %s\r\n",filenaam);
   }

   disable(); //dos interrupts worden uitgezet
   handle = open(filenaam, O_RDONLY);
   filelth=filelength(handle);
   close(handle);

   stream = fopen(filenaam, "rb");
   if (stream==NULL)
   {
      textcolor(RED);
      cprintf("ERROR: File could not be found.\r\n");
   }
   else
   { // 1e 4 chars lezen om testen exportdir of normaal regdump.
      detect[0] = fgetc(stream);
      detect[1] = fgetc(stream);
      detect[2] = fgetc(stream);
      detect[3] = fgetc(stream);
      if (detect[0]=='C')
	 if (detect[1]=='R')
	    if (detect[2]=='E')
	       if (detect[3]=='G')
		  export=2; // oftewel normal regdump.
      if (detect[0]=='R')
	 if (detect[1]=='E')
	    if (detect[2]=='G')
	       if (detect[3]=='E')
		  export=1; // oftewel EXPORTED regdump.
      switch(export){
	 case 0: printf("Fileformat not recognized\n");break;
	 case 1: printf("exported registry detected\n");break;
	 case 2: printf("normal registry detected\n"); break;
      }

      meeloop=0;
      while (meeloop<filelth && einde==0)
      {
	 /* read a char from the file */
	 ch = fgetc(stream);
	 /* display the character */
	 if (bool==1 && export==2)
	 {
	    huidigpw[count]=ch;
	    count++;
	    if (count>37) einde=1;  // wachtwoord groter dan 18 characters..

	 }
	 if (bool==1 && export==1)
	 {
	    if (skipbagger<6) skipbagger++;
	    else {
	       if (ch!=','){
		  detect[odd]=ch;
		  if (odd==0)
		     odd=1;
		  else
		     if (odd==1){
			odd=0;
			detect[2]=',';
			detect[3]=char(0);
			sscanf(detect,"%x,",ch);
			if (detect[0]='0' && detect[1]=='0') einde=1;
			else{
			  huidigpw[count]=ch;
			  count++;
			}
			if (count>37) einde=1;  // wachtwoord groter dan 18 characters..

		     }
	       }
	    }
	 }

	 if (bool==1)
	    if (ch==char(0))
	       einde=1;   // end of password string found.
	 if (bool==1)
	    if (ch=='\n')
	       einde=1;
	 if (ch==zin[counter])
	 {
	    counter++;
	    if (counter > 14) bool=1;   // begin password string found.

	  }else counter=0;
	  meeloop++;
      }
      fclose(stream);
      enable(); // interrupts mogen weer gebeuren..
      ch=34;

      if (einde==1)
      {
	 cprintf("\r\nPassword is : %c",ch);
	 if (count>1)
	 {
	    for( meeloop=0;meeloop<=((count-2)/2);meeloop++)
	    {
	       ch=decode(huidigpw[2*meeloop],huidigpw[2*meeloop+1],(meeloop+1));
	       if (ch<127)
	       {
		  textcolor(WHITE);
		  cprintf("%c",ch);
	       }
	       else
	       {
		  textcolor(RED);
		  cprintf("<?>");
	       }
	    }
	 }
	 ch=34;
	 textcolor(DARKGRAY);
	 cprintf("%c\r\n",ch);

      }
      else
      {
	 textcolor(RED);
	 cprintf("\r\nNo screensave password found\r\n");
      }
   }
   textcolor(LIGHTGRAY); // doskleuren weer normaal zetten.
   cprintf("\r\n"); // niet vergeten anders nie werk nie..
   return 0;
}

