小编rom*_*ngo的帖子

PHP中的等效AES 128位

我在Java中有这段代码,它使用AES 128位将源String加密为Base64加密值.但是我找不到类似的PHP函数产生相同的结果.任何帮助将不胜感激

    String key = "1234567890123456";
    String source = "The quick brown fox jumped over the lazy dog";

    byte[] raw = key.getBytes();
    SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");

    // Instantiate the cipher
    Cipher cipher = Cipher.getInstance("AES");

    cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

    byte[] encrypted = cipher.doFinal(source.getBytes());
    System.out.println(new String(Base64.encodeBase64(encrypted)));
Run Code Online (Sandbox Code Playgroud)

php java encryption aes

2
推荐指数
1
解决办法
7681
查看次数

标签 统计

aes ×1

encryption ×1

java ×1

php ×1