How to implement python encryption with PHP

< H2 > python encryption < / H2 >
def des_encrypt(data, Des_Key):
    if isinstance(data, dict):
        str = json.dumps(data)
    else:
        str = data
    Des_IV = bytes(Des_Key)
    k = des(Des_Key, CBC, Des_IV, pad=None, padmode=PAD_PKCS5)

    EncryptStr = k.encrypt(str)
    return base64.b64encode(EncryptStr) -sharpbase64

how to implement

with PHP? < hr >

python uses the package pyDes

Apr.09,2021

PHP has a OpenSSL function that can be written by itself, and it's nice to have a phpseclib in the third-party library.


W3school
Baidu PHP crypt can find it =


php7 take a look at openssl

Menu