We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ad686d commit 6e93212Copy full SHA for 6e93212
Encryption App/AES/pbkdf2hash.cs
@@ -0,0 +1,27 @@
1
+using System;
2
+using System.Security.Cryptography;
3
+
4
+namespace PBKDF2Hash
5
+{
6
+ private static byte[] GenerateSalt()
7
+ {
8
+ var csprng = new RNGCryptoServiceProvider();
9
+ var salt = new byte[32];
10
+ csprng.GetBytes(salt);
11
+ return salt;
12
+ }
13
14
+ public static (byte[] hash, byte[] salt) pbkdf2hash(string password)
15
16
17
+ string password = "passwd";
18
+ byte[] salt = GenerateSalt();//warning shouldnt be random salts - change when you try and decrypt no?
19
+ int iterations = 100000;
20
+ byte[] hashValue;
21
+ using (var pbkdf2 = new Rfc2898DeriveBytes(password, salt, iterations))
22
23
+ hashValue = pbkdf2.GetBytes(32);
24
25
+ return (hashValue,salt);
26
27
+}
0 commit comments