Subscribe

Generating passkeys

  1. 2010-03-14 11:59:44 PDT
    Hi, Seems many like me have problems with generating the passkeys. So could somebody please tell exactly how to save the hash? Originally the hash is looking like this db8d02757202c0516a6cb98647ff3f1fa75b6b69 how and with what to convert it to fit into binary(20) field? When we are crating the passkey should we unconvert it and then insert it into the "mixer"? And one more question: I noticed that the user passkey field is int, but the created passkey maybe is not a int? Thank you!
  2. 2010-03-14 12:14:28 PDT
    You 'unhex' it before you put it in the DB and you 'hex' it after you take it out. You don't put the passkey in the DB, you put it in the .torrent.
  3. 2010-03-14 12:33:34 PDT
    Hmm... Strange... Okay here is that what i do - with the "UNHEX" sql function i "unhex" the info_hash and insert the torrent data into the db. Before i send the edited torrent file i insert into the passkey mix the "hexed"(who i hexed with "HEX" sql function) passkey, but it still says "unregistered torrent pass".
  4. 2010-03-15 08:04:33 PDT
    Output: 000b905e7ac70f94ed4708626ea88352 Code: $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));
  5. 2010-03-18 05:46:20 PDT
    Yes i generate the passkeys in the same way... I unhex the hash when i add the torrent into the database and hex it when i'm inserting it to the passkey mix, but it still says "unregistered torrent pass". Can the database encoding be a problem? I'm using utf8_unicode_ci and the unhexed info_hash into the database is looking like ")V���(Q����2���O". Should it be like this? I'dont have any other idea where the problem could be...
  6. 2010-03-18 05:49:48 PDT
    Maybe you shouldn't hex it yourself, as the PHP pack function also hexes it. Have a look at xbt\Tracker\htdocs\xbt_torrent_pass_version.php
  7. 2010-03-18 05:50:04 PDT
    Oops the info_hash is not showed correctly in the previos post. Here is an picture how the things are looking.
  8. 2010-03-18 05:59:47 PDT
    The pack() function may hex them, but if i dont hex the data from the database pack() cant read the characters and display errors. For that I'm wondering if there is any problem with the database encoding. See the picture above.
  9. 2010-03-18 06:01:32 PDT
    Why can't pack read the bytes? And if you've got an old version of phpMyAdmin, those weird chars are normal.
  10. 2010-03-18 06:06:17 PDT
    Here is another picture.
  11. 2010-03-18 06:07:51 PDT
    Use xbt\Tracker\htdocs\xbt_torrent_pass_version.php
  12. 2010-03-18 06:30:57 PDT
    Hmm... I checked my code again and i saw that i dont mix the correct torrent pass private key and fix it. Now the tracker says "unregistered_torrent".
  13. 2010-03-18 06:32:35 PDT
    Then the info_hash isn't in xbt_files...
  14. 2010-03-18 06:32:36 PDT
    The error message is changed again and now its back to "unregistered torrent pass".
  15. 2010-03-18 06:34:39 PDT
    Then you did something else wrong.
  16. 2010-03-18 06:51:22 PDT
    I've made some tests. First i checked what torrent pass will generate torrent_pass_version.php and then compare it with the torrent pass that my code generates and insert into the torrent and the result was that they are the same. So maybe the problem is not there?
  17. 2010-03-19 02:48:42 PDT
    Okay i'm really thinking that the problem is there. How should the info_hash field in the database look?
  18. 2010-03-19 03:54:34 PDT
    Since the type is binary(20), a good guess would be the binary unhexed format. ;)
  19. 2010-08-31 02:21:57 PDT
    @olaf: Maybe it's a good idea to put the information on how to generate the passkey to the homepage? The question seems to pop up regularly.. Thanks.
  20. 2010-08-31 02:32:41 PDT
    The code is already in xbt/Tracker/htdocs/xbt_torrent_pass_version.php
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.