What's the purpose of the hash added to filenames in custom folder?
Two reasons I can think of:


what happens if you upload twice a file with the same name for different contacts? the hash allow to avoid overwriting
probably increase a bit the protection and privacy too, eg. by guessing and trying to download warren_buffet.jpg or bill_gates.jpg, we could know if you have some wealthy donors in your db 


This being said, it's been there since forever and I never quite questioned it.

If it's for mass uploading contact images, you can probably just set the field into civicrm_contact and put the image at the right place, I remember having done something like that a while ago, it probably still works

as andy detailled, you need to touch a few more tables if you want to upload the file in a custom field


add a row to civicrm_file with the file name
add a row to civicrm_entity_file to link to the contact id, civicrm_file table &amp; your custom table 
update your custom table with the numeric id from the civicrm_file 
upload the file into the right folder