I know that this reply is to a very, very old post but I wanted to put here an answer that I found for others that may be looking for it. This is taken from the DrupalVB module to auto login to Drupal. This module sets cookies for vBulletin to look for.
I am using this module with Drupal 6.17 and vBulletin 3.8.4 PL2
The below is in PHP
Code:
$idhash = md5($_SERVER['HTTP_USER_AGENT'] . $vbuser['userid']);
$sessionhash = md5($now . request_uri() . $idhash . $_SERVER['REMOTE_ADDR'] . user_password(6));