PHP翻译python加密函数

I was trying to rewrite a python registration page of a game server to PHP, before inserting the password to database it is encrypted with the following function

hash = binascii.b2a_hex(self.cipher.encrypt(binascii.a2b_hex(hash)))

I'm not familiar with encryption and have no clue how to translate this to PHP

OK, let's do this step by step.

Initially, the hexadecimal hash is converted to binary using the binascii's function a2b_hex. The PHP equivalent of that would be hex2bin.

Then, you're using cipher's encrypt function to, supposedly, encrypt the previously obtained value. This is one of your classes, so I can't really guess what it does. Go find out.

Finally, just use the reverse equivalent of PHP's hex2bin: bin2hex().

PS: this hashing procedure looks really, really, weird to me...