Generating an ECP hash.

Jun 19, 2008 01:13

(Bumping this up from earlier comments in the hopes of assistance.)

I'm stuck on one issue. I've used the form sent out via comment emails as a basis, but I'm having a hard time generating the ECP hash.

In talklib.pl, the hash is generated like so:

sub ecphash ( Read more... )

client: posting, *revisit, client, code: perl, code: php

Leave a comment

Comments 11

thelovebug June 19 2008, 05:33:36 UTC
Doesn't the phrase 'ecph-' need to be prepended to the final hash?

Reply

professormass June 19 2008, 15:03:30 UTC

I'm doing that in the live code.

Reply


ydna June 19 2008, 05:45:16 UTC
I don't know PHP. Does the PHP md5() return a hex encoded string or a binary value? If the latter, it needs to be converted into hex string. Also, missing the "ecph-" at the head of the result.

Reply

professormass June 19 2008, 15:03:54 UTC

As mentioned above, I'm doing that in the live code.

Reply


soph June 19 2008, 08:47:48 UTC

ciaran@neo:~$ php

82da61aa724b5d149a9c5dc8682c2a45
ciaran@neo:~$
ciaran@neo:~$ perl
use Digest::MD5;
print Digest::MD5::md5_hex("md5test") . "\n";
82da61aa724b5d149a9c5dc8682c2a45
ciaran@neo:~$

Yes, they do the same. :D The "ecph" thing would be what's causing it - you're not prepending "ecph-" to the hash.

Reply

professormass June 19 2008, 15:04:57 UTC

Okay, so they do the same...has anybody tried this with the actual data it's supposed to be hashing? My concern is that the 'password' component isn't a clear-text password, but rather, something pre-encrypted and pulled from LJ's database.

Reply

soph June 19 2008, 15:33:48 UTC
Actually, the problem here isn't to do with the password, it's to do with the item IDs you're using.

The itemid you want is *not* the ID that's passed in the "itemid" field of the form (which is its ditemid), but instead the jitemid, which can be found as int($ditemid / 256). So for this comment I'm replying to, for example, the entry itemid is 786311, but its jitemid, which is what I need to hash, is int(786311 / 256) = 3071. Has together "307133966my plaintext password here" and you'll get the hash you want.

The parenttalkid is calculated in a similar way - the displayed comment ID here is 8695687, but the ID that you want to pass is int(8695687 / 256) = 33967. However, you're given this figure in the form already, so you don't have to calculate it yourself. [edit: Well, okay, maybe it's that -1 for the comment ID... but I know it's right for the entry ID.]

Reply

professormass June 19 2008, 16:47:55 UTC

SUCCESS!

Thank you!

Reply


conymac August 24 2008, 07:23:21 UTC
Hello :)
do you know how i can post a new post ?
i mean wich form variables i need and how i'm calculating the item IDs in that case ?
thanks a lot.

Reply

professormass August 24 2008, 11:06:45 UTC

You shouldn't need to figure out any of that stuff. Just use the XML-RPC interface with the parameters described here:

http://www.livejournal.com/doc/server/ljp.csp.flat.postevent.html

Many languages have XML-RPC interfaces. PHP's, for example, is described here:

http://ca.php.net/manual/en/ref.xmlrpc.php

Reply


Leave a comment

Up