I don't know what the php method equivalent python that i should use in python. I tried to generate some code but it wrong and doesn’t work. Can anyone help me convert this code php to python
PHP:
tracking = base64_encode(openssl_random_pseudo_bytes(40));
id = substr(md5(tracking), 16);
Python
tracking = os.urandom(40)
print(tracking)
>>> YidceGM1XHhjZVx4MTBceGVkX1x4OGFxXHhkN0NcdFhQU1x4ZTdceDA0Mip7KVx4OGRceDFjXHhhYlx4ODdAcFpceGVmXHg4ZXVcdFZHdFdceGM2OnZceGUyXFxceDFlJw==
But correctly code length must be 56 but in python generated so long
example correct tracking :
PldikuqQF1/acrFfnfkBr6pIFjRZ9eLzsgQf6hpRVm/e8s1kmOrqjw==
X2g1P0ORzhlyDCUzSrS2o2n8EgZYpXvzBkNMMdEyNegqjr8GbTlOGA==
example correct id :
a3c6b613c95f4ea9