diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-02-04 17:59:41 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-02-04 17:59:41 -0600 |
| commit | ec9a2d9b8556be8f5f88b44e18a9fc03b4cefbd6 (patch) | |
| tree | b1423d2c798f95d62048498d5b31123ce434cb5c /src/slskd/Security | |
| parent | e59d78b700150c838209c4fac8a42945dc7dd49a (diff) | |
| download | slskd-ec9a2d9b8556be8f5f88b44e18a9fc03b4cefbd6.tar.gz | |
move PBKDF2
Diffstat (limited to 'src/slskd/Security')
| -rw-r--r-- | src/slskd/Security/PBKDF2.cs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/slskd/Security/PBKDF2.cs b/src/slskd/Security/PBKDF2.cs deleted file mode 100644 index 4a857135..00000000 --- a/src/slskd/Security/PBKDF2.cs +++ /dev/null @@ -1,28 +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); - } - } - } -} |
