Replacing JAVA with PHP for PKCS5 encryption

前端 未结 3 1376
抹茶落季
抹茶落季 2021-02-09 12:16

I have been tasked with replacing a legacy java system with something which runs PHP.

I am getting a little stuck on replacing the java cryptography with PHP code.

3条回答
  •  无人共我
    2021-02-09 12:45

    You can use hash_pbkdf2 PHP (5.5) function too instead of using PBKDF2 PHP libraries.

    According to PHP docs the GUESS 1 is the length of the created derived key

    length

    The length of the output string. If raw_output is TRUE this corresponds to the byte-length of the derived key, if raw_output is FALSE this corresponds to twice the byte-length of the derived key (as every byte of the key is returned as two hexits).

    If 0 is passed, the entire output of the supplied algorithm is used.

    Maybe this post (what is an optimal Hash size in bytes?) result interesting for you.

    GUESS 2 or IV is a random initialization vector used to create an unique salt to generate the hash.

    You can create the IV with mycript_create_iv function.

    Take a look at the complete sample in PHP.net

    
    

提交回复
热议问题