aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/Cryptography/PBKDF2.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-02-13 17:05:59 -0600
committerGitHub <noreply@github.com>2021-02-13 17:05:59 -0600
commit034eff1ad47a4ac976237d4e13c596ba1404cd2f (patch)
tree8d9650d86237fe511a600ae58016b1ff3de3a389 /src/slskd/Common/Cryptography/PBKDF2.cs
parentaec49da74c08865353faae4d97fb4e405ae970e5 (diff)
parent1744c9b2ded05a8a83874864957229a3235fb546 (diff)
downloadslskd-034eff1ad47a4ac976237d4e13c596ba1404cd2f.tar.gz
Merge pull request #40 from slskd/housekeeping
Tidy up
Diffstat (limited to 'src/slskd/Common/Cryptography/PBKDF2.cs')
-rw-r--r--src/slskd/Common/Cryptography/PBKDF2.cs26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/slskd/Common/Cryptography/PBKDF2.cs b/src/slskd/Common/Cryptography/PBKDF2.cs
deleted file mode 100644
index 4b8b83e4..00000000
--- a/src/slskd/Common/Cryptography/PBKDF2.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace slskd.Security
-{
- using Microsoft.AspNetCore.Cryptography.KeyDerivation;
- using System.Security.Cryptography;
-
- /// <summary>
- /// PBKDF2/RFC 2898 implementation
- /// </summary>
- public static class PBKDF2
- {
- /// <summary>
- /// Gets a 256 bit (32 byte) key derived from the specified <paramref name="password"/> using PBKDF2/RFC 2898
- /// </summary>
- /// <param name="password"></param>
- /// <returns></returns>
- public static byte[] GetKey(string password)
- {
- byte[] salt = new byte[16];
- int iterations = 1000;
-
- using var rng = RandomNumberGenerator.Create();
- rng.GetBytes(salt);
- return KeyDerivation.Pbkdf2(password, salt, KeyDerivationPrf.HMACSHA256, iterations, 32);
- }
- }
-}