I would suggest to use
Salt in a combination with
SHA1 pretty much what we discussed in your last
thread regarding passwords
Readingthe
Storing passwords - done right article might give you some idears.
If you're accostum to the routine of writing/reading files, it's not much different with quering a database, you retrieve the data which matches, run through it in a loop and do with the found data as you see fit, very much like you would with a flat file.
It's just different function-calls you'd use.