回答編集履歴

1

fix

2016/04/01 07:18

投稿

ngyuki
ngyuki

スコア4514

test CHANGED
@@ -20,6 +20,20 @@
20
20
 
21
21
  ```php
22
22
 
23
- $encrypted = bin2hex(openssl_encrypt($data, $method, $password, OPENSSL_RAW_DATA));
23
+ $encrypted = bin2hex(openssl_encrypt($data, $method, $password, OPENSSL_RAW_DATA, $iv));
24
24
 
25
25
  ```
26
+
27
+
28
+
29
+ 複合は逆に `hex2bin` を使います。
30
+
31
+
32
+
33
+ ```php
34
+
35
+ $decrypted = openssl_decrypt(hex2bin($encrypted), $method , $password, OPENSSL_RAW_DATA, $iv);
36
+
37
+ ```
38
+
39
+