質問編集履歴
1
誤字、文法修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
-
Console.WriteLine(Dec
|
47
|
+
Console.WriteLine(Decode("・・・","aaaa"));
|
48
48
|
|
49
49
|
|
50
50
|
|
@@ -54,21 +54,21 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
-
private string Dec
|
57
|
+
private string Decode(string text, string p)
|
58
58
|
|
59
59
|
{
|
60
60
|
|
61
|
-
System.Security.Cryptography.RijndaelManaged _rijnde
|
61
|
+
System.Security.Cryptography.RijndaelManaged _rijndael = new System.Security.Cryptography.RijndaelManaged();
|
62
62
|
|
63
63
|
|
64
64
|
|
65
65
|
byte[] _key, _iv;
|
66
66
|
|
67
|
-
G
|
67
|
+
GKFP(p, _rijndael.KeySize, out _key, _rijndael.BlockSize, out _iv);
|
68
68
|
|
69
|
-
_rijnde
|
69
|
+
_rijndael.Key = _key;
|
70
70
|
|
71
|
-
_rijnde
|
71
|
+
_rijndael.IV = _iv;
|
72
72
|
|
73
73
|
|
74
74
|
|
@@ -76,7 +76,7 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
-
System.Security.Cryptography.ICryptoTransform _decryptor = _rijnde
|
79
|
+
System.Security.Cryptography.ICryptoTransform _decryptor = _rijndael.CreateDecryptor();
|
80
80
|
|
81
81
|
|
82
82
|
|
@@ -92,23 +92,23 @@
|
|
92
92
|
|
93
93
|
|
94
94
|
|
95
|
-
public static void G
|
95
|
+
public static void GKFP(string pass, int keySize, out byte[] key, int blockSize, out byte[] iv)
|
96
96
|
|
97
97
|
{
|
98
98
|
|
99
|
-
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("
|
99
|
+
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("・・・");
|
100
100
|
|
101
101
|
|
102
102
|
|
103
103
|
System.Security.Cryptography.Rfc2898DeriveBytes _deviceBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(pass, _salt);
|
104
104
|
|
105
|
-
|
105
|
+
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
key = _deviceBytes.GetBytes(keySize
|
109
|
+
key = _deviceBytes.GetBytes(keySize);
|
110
110
|
|
111
|
-
iv = _deviceBytes.GetBytes(blockSize
|
111
|
+
iv = _deviceBytes.GetBytes(blockSize);
|
112
112
|
|
113
113
|
}
|
114
114
|
|