@@ -61,7 +61,7 @@ unittest
6161 return encrypted[0 .. encryptedLen + padLen].assumeUnique();
6262 }
6363
64- // 複合
64+ // 復号
6565 immutable (ubyte )[] decryptAES128 (in ubyte [] src, in ubyte [128 / 8 ] key, in ubyte [16 ] iv)
6666 {
6767 // 暗号化のコンテキスト作成・破棄
@@ -73,18 +73,18 @@ unittest
7373 decctx.EVP_DecryptInit_ex(EVP_aes_128_cbc(), null , key.ptr, iv.ptr)
7474 .enforce(" Cannot initialize OpenSSL cipher context." );
7575
76- // 複合されたデータの格納先として 、十分な量のバッファを用意。
76+ // 復号されたデータの格納先として 、十分な量のバッファを用意。
7777 // 暗号化のロジックによって異なる。
7878 // AES128だったら元のデータよりブロックサイズ分の16バイト大きければ十分格納できる。
7979 ubyte [] decrypted = new ubyte [src.length + 16 ];
8080
81- // 複合
82- // ここでは一回で複合を行っているが 、分割することもできる。
81+ // 復号
82+ // ここでは一回で復号を行っているが 、分割することもできる。
8383 int decryptedLen;
8484 int padLen;
8585 decctx.EVP_DecryptUpdate(decrypted.ptr, &decryptedLen, src.ptr, cast (int )src.length)
8686 .enforce(" Cannot encrypt update OpenSSL cipher context." );
87- // 複合完了
87+ // 復号完了
8888 decctx.EVP_DecryptFinal_ex(decrypted.ptr + decryptedLen, &padLen)
8989 .enforce(" Cannot finalize OpenSSL cipher context." );
9090
@@ -93,15 +93,15 @@ unittest
9393
9494 import std.conv : hexString;
9595 import std.string : representation;
96- // ここでは以下のデータを暗号化して、複合します 。
96+ // ここでは以下のデータを暗号化して、復号します 。
9797 static immutable ubyte [] sourceData = " あいうえお" c.representation;
9898 // 鍵とIVには以下を使用。
9999 // 鍵は128bit(16バイト), IVはブロックサイズの16バイト
100100 static immutable ubyte [128 / 8 ] key = cast (ubyte [128 / 8 ])hexString! " 9F86D081884C7D659A2FEAA0C55AD015" ;
101101 static immutable ubyte [16 ] iv = cast (ubyte [16 ])hexString! " A3BF4F1B2B0B822CD15D6C15B0F00A08" ;
102102 // 暗号化
103103 auto encryptedData = encryptAES128(sourceData, key, iv);
104- // 複合
104+ // 復号
105105 auto decryptedData = decryptAES128(encryptedData, key, iv);
106106 // 確認
107107 assert (decryptedData == sourceData);
0 commit comments