Skip to content

Commit 1376c78

Browse files
authored
Merge pull request #3 from nathanmc158/master
AES folder and pbkdf2hash.cs created
2 parents 2ad686d + 063e68f commit 1376c78

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

Encryption App/AES/pbkdf2hash.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# EncryptionApp
1+
# EncryptionApp
2+
3+
## Documentation:
4+
5+
6+
## To do:

todo.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)