| MH uses monotonically-increasing small positive integers to number | messages within a folder. Maildir, as I recall, uses large | pseudo-random numbers, or what appear to be pseudo-random numbers.
Maildir uses the structure folder/{tmp,cur,new}/unique.file.name. The files are required to be uniquely named, and there is a convention for the intermediate directories. djb has a brief but detailed specification under cr.yp.to somewhere, if you want to google for it.