"and I'm not able to to use AUTO_INCREMENT on the mySQL side"
Why not?
"What's the best way to go if I want to make sure the ID is 100% unique and at the same time don't want to waste extra bytes for a huge ID?"
You can't make a unique ID, you can only create an id and check wether it is already in use.
The 'best' but still horribly wrong method is to fake the auto_increment.
Lock the table exclusively (this is the bad part, nobody else can do anything with the table untill you are finished)
Select the highest ID value + 1:
SELECT MAX(id)+1 AS newid FROM table;
Use that new id as the ID value for the next insert.
Note: You cannot unlock the table untill you have succesfully inserted the new value, otherwise other copies of the script might get the same value and try to insert a duplicate value.
So if you do a lot of inserts, this can/will have a serious impact on the speed of your database.
But I'm really curious about why you can't use auto_increment...
A forum, a FAQ, what else do you need?