国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP 如何實現(xiàn)java的PbeWithMd5AndDes加密解密
七
2020-07-31 11:37:47
0
0
2632

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++) { ? ? ? ? 鹽[i] = 摘要[i]; ? ? ?} ? ? ?PBEKeySpec pbeKeySpec = new PBEKeySpec(key.toCharArray()); ? ? ?SecretKeyFactory keyFactory = SecretKeyFactory ? ? ? ? ? ?.getInstance("PBEWithMD5AndDES"); ? ? ?SecretKey skey = keyFactory.generateSecret(pbeKeySpec); ? ? ?PBEParameterSpec paramSpec = new PBEParameterSpec(salt, ITERATIONS); ? ? ?Cipher 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 (Exception e) { ? ? ?e.printStackTrace(); ? } ? return "";}將bejava加密利用PHP進行解密

七

全部回復(fù)(0)
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板