Creating Users via PHP / MySQL

Hello All,

I have been creating users via the following code:

require_once('groups/engine/start.php');
            $guid = register_user($username, $password, $username, $login, true);
            $new_user = get_entity($guid);
            $new_user->access_id = 2;
            $new_user->admin_created = true;
            $new_user->enable(); 

But I have a number of older users that I would like to create on my elgg community.

The user's passwords are recorded using MD5 (same as elgg), but I cannot use the above scripts to create these.  Basically I need to nkow how I can use my current user records to create elgg accounts for them using the same username, email and password they have for my main site.  I do not have their passwords in clear text (nor do I want them).  How I can I go about doing this (setting the correct salt values, etc).

 

Please help!!!