public static String encrypt(String key, String plainText){ String encryptTxt = ""; { byte[] Salt = new byte[8]; を試してください。 MessageDigest md = MessageDigest.getInstance("MD5"); md.update(key.getBytes()); byte[] ダイジェスト = md.digest(); for (int i = 0; i < 8; i ) { Salt[i] = Digest[i]; PBEKeySpec pbeKeySpec = new PBEKeySpec(key.toCharArray()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("PBEWithMD5AndDES"); SecretKey skey = keyFactory.generateSecret(pbeKeySpec); PBEParameterSpec paramSpec = 新しい PBEParameterSpec(salt, ITERATIONS);暗号 cipher = Cipher.getInstance("PBEWithMD5AndDES"); cipher.init(Cipher.ENCRYPT_MODE, skey, paramSpec); byte[] cipherText = cipher.doFinal(plainText.getBytes()); String SaltString = new String(Base64.encode(salt)); String ciphertextString = new String(Base64.encode(cipherText)); SaltString ciphertextString を返します。 catch (例外 e) { e.printStackTrace(); } return "";} この段落をjava加密使用PHP実行解密