0
Hello guys I’m having the following problem I need to create a php script based on a python script would be all right until I find it:
hashlib.md5(b"55M5033B556EUU53").digest()
the exit: "b'P.\xfd\xe9\xdez\xc0*\xf1\x0eC\x93\xc9L\xad\xaa'
"
The problem is that I don’t know anything in php that I return this, I’ve done several searches and nothing, reading the php documentation I found this:
echo openssl_digest("55M5033B556EUU53", "md5");
the exit: "502efde9de7ac02af10e4393c94cadaa
".
If I do it in python:
hashlib.md5(b"55M5033B556EUU53").hexdigest()
the exit: "502efde9de7ac02af10e4393c94cadaa
".
It’s the same as php, but the problem is that I need it: "P.\xfd\xe9\xdez\xc0*\xf1\x0eC\x93\xc9L\xad\xaa
" in php, someone can tell me how or at least give me an orientation of what I should search for to find the solution.
For me to finish the script in php just missing this function, but for me to try to write this function in php I need the key in this format "P.\xfd\xe9\xdez\xc0*\xf1\x0eC\x93\xc9L\xad\xaa
" because if in python I put this "502efde9de7ac02af10e4393c94cadaa
" in the error function:
import hashlib
from Cryptodome.Cipher import AES
from clint.textui import progress
unpad = lambda d: d[:-d[-1]]
def decrypt_progress(inf, outf, key, length):
cipher = AES.new(key, AES.MODE_ECB)
assert length % 16 == 0
chunks = length//4096+1
for i in progress.bar(range(chunks)):
block = inf.read(4096)
if not block:
break
decblock = cipher.decrypt(block)
if i == chunks - 1:
outf.write(unpad(decblock))
else:
outf.write(decblock)
with open(inff, "rb") as inf:
with open(outft, "wb") as outf:
decrypt_progress(inf, outf, key, length)
inf is the encrypted file out location where the decrypted file will be saved key = 55M5033B556EUU53 file size
From now on I thank you all.