Subscribe

Problem With Passkeys

  1. 2010-03-07 16:39:22 PST
    I am having some issues with creating passkeys. I have the binary form of a torrent info hash. Using file/bittorrent2 libs. I then try to generate the key via the following code: $site_keyQ = "SELECT `value` FROM `xbt_config` WHERE name='torrent_pass_private_key'"; if($result = $dbLink->query($site_keyQ)){ while ($row = $result->fetch_row()){ $site_key=$row[0];} $result->close(); } $torInHash = "SELECT `info_hash` FROM `xbt_files` WHERE fid={$fid}"; if($result = $dbLink->query($torInHash)){ while ($row = $result->fetch_row()){ $info_hash=$row[0];} $result->close(); } $torPaQu = "SELECT `torrent_pass_version` FROM `xbt_users` WHERE uid={$uid}"; if($result = $dbLink->query($torPaQu)){ while ($row = $result->fetch_row()){ $torrent_pass_version=$row[0];} $result->close(); } $passkey = sprintf('%08x%s', $uid, substr(sha1(sprintf('%s %d %d %s', $site_key, $torrent_pass_version, $uid, pack('H*', $info_hash))), 0, 24)); But I still get the tracker reporting unregistered pass key. How can I resolve this issue?
  2. 2010-03-09 04:53:54 PST
    This is the code I've got: <?php $info_hash = 'aabbccddf8c594cf481dbd4d12f0c376bae7d334'; $torrent_pass_private_key = 'xxx'; $torrent_pass_version = 3; $uid = 757854; printf('%08x%s', $uid, substr(sha1(sprintf('%s %d %d %s', $torrent_pass_private_key, $torrent_pass_version, $uid, pack('H*', $info_hash))), 0, 24));
  3. 2010-03-09 06:55:10 PST
    Hmm well its the same pass key, I just renamed the variables from torrent_pass_private_key to $site_key. Does the info hash have to be in hex? Cause I have to format to binary on my upload script. Also what are the differences in torrent_pass_versions?
  4. 2010-03-09 06:57:54 PST
    Yes, it has to be hex... Every time you want to reset the torrent_pass, you just increase the version.
  5. 2010-03-10 18:45:05 PST
    Well my code does the same as your posted but I am still getting unregistered pass. I made it go to hex and fit into the 20 bit binary field. Still no go.
  6. 2010-03-11 02:13:20 PST
    The xbt_files.info_hash field is binary(20)... You can't put a char(40) in there. You should convert it to hex just before you calculate the torrent_pass. It should stay binary inside the database.
  7. 2010-03-18 23:13:09 PDT
    I got it to work. I had to upload as binary, then convert the binary to hex and it works fine. Thanks so much!!! :)
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.