You can use any hashing solution you like, subject to the usual constraints, the most important of which being that all hash values are equally likely. Modulus might be totally fine if the files are numbered sequentially.
Even if you were to use a cryptographic hash (NOT recommended), the cost is trivial compared to what the filesystem needs to do to create a file. Modulus is fine.
But you might also want to think about human users. How will they (you) find a file? Dividing by ranges is much easier to manage. Then you can name each directory by the beginning of the range, and it is a simple task to find the correct directory.
When you use numbers as filenames, you will at some point wish you had zero-padded them all to the same length so that alphabetic order and numeric order are the same. I strongly suggest you get this right from the start. The most common moment to notice the problem is when it is necessary to bulk retrieve backups.