简体   繁体   中英

Java equivalent for PHP crypt with crypt key

I am trying to find a java equivalent for PHP crypt() function. I found it here , but the answer says nothing about crypting with a crypt key. I have a PHP website which uses md5 encryption and I have a datatable for users with their passwords encrypted like this

crypt($password, CRYPT_KEY)

with CRYPT_KEY being a constant. Now I need to use that same datatable for a project in Java. How can I use the Java digest function (or any other md5 encyption function) with a crypt key?

Which hashing algorithm does your combination of php-version/platform use? php's crypt() can choose from a number of algorithms as detailed here: http://php.net/manual/en/function.crypt.php

The commons-codec from Apache has a class Crypt that implements this functionality. As of version 1.10, it supports these algorithms:

  • CRYPT_SHA512
  • CRYPT_SHA256
  • CRYPT_MD5
  • CRYPT_STD_DES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM