J
J
Jay Marlow2017-02-03 10:43:19
PHP
Jay Marlow, 2017-02-03 10:43:19

How to find out the hash type and how to decode it?

Good day.
Trying to make my api for the iii.ru bot (I write in python) I came across the fact that the data is sent to this bot in the form of a hash, I suspect, here is an example:

JBYkHG4cLEE3RzdVPyoQWSEEMUs/ICNZIB1xAzAZIV07JxBSID1mBzU6ZwY4HjMEbzchCD4iLyUWPDBXLRlVHQ==

Is it possible to do something and find a way to send and receive data to the bot using its some hashing algorithm?
Googling resulted in just one piece of code that seems to work with iii.ru and is written in php.
Here is the part that I understand is responsible for this moment with the hash, but I can not understand it:
static function xorKey($res, $decode)
    {
        $key = "some very-very long string without any non-latin characters due to different string representations inside of variable programming languages";
        $keylen = strlen($key);
        $res = $decode ? base64_decode($res) : base64_encode($res);
        $strlen = strlen($res);
        $i = 0;
        $result = '';
        while ($i<$strlen)
        {
            $buf = $res[$i] ^ $key[$i % $keylen];
            $result .= $buf;
            $i++;
        }
        return $decode ? base64_decode($result) : base64_encode($result);
    }

I would be grateful for any advice.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2017-02-03
@kolumbou

it's a base64 string, not a hash.
the content of the decoded string doesn't look like any hash I know of.
in the above function, everything is simple, but it is useless if the real key is not known.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question