how is the affiliate Id genarated and where are they stored

I have a plugin that needs to be integrated with the affiliate plugin and the programmer needs to know how the affiliate ids are generated and where they are stored in the database I looked in the data base but I couldnt find the affiliate ids