Calculate redirect hash in drupal 7? I'm upgrading my site from D6 to D7, and want to move a section of the site to a better spot. That requires about 10000 redirects. (I use redirect module: https://drupal.org/project/redirect ).

With D7, the redirect table includes a hash ("hash - A unique hash based on source, source_options, and language."). How can I build that, using PHP? I have a textfile with node/# and the old URLs. I can make them into a mysql table.

But while I can do basic PHP, I'm not advanced enough to understand the redirect.module source. The relevant bits are, I understand, lines 399-403:

$redirect-&gt;source = $path['original']['alias'];
$redirect-&gt;redirect = $path['source'];
$redirect-&gt;language = $path['original']['language'];
// Check if the redirect exists before saving.
$hash = redirect_hash($redirect);`


and lines 1069-1081:

function redirect_hash($redirect) {
  $hash = array(
    source' =&gt; $redirect-&gt;source,
    language' =&gt; $redirect-&gt;language,
  );
  if (!empty($redirect-&gt;source_options['query'])) {
    $hash['source_query'] = $redirect-&gt;source_options['query'];
  }
  drupal_alter('redirect_hash', $hash, $redirect);
  redirect_sort_recursive($hash, 'ksort');
  $redirect-&gt;hash = drupal_hash_base64(serialize($hash));
  return $redirect-&gt;hash;
}


Thanks!
Usually there is always a module that can help out. 

In your case I recommend Path Redirect Import. It has a bulk import mechanism for redirects via CSV. It supports the Drupal 7 redirect module.

To get the redirects exported from D6 in the right format, check the Path Redirect Export module.

I believe that should do the trick for you.

I hope this helps you.