<commit_before>﻿namespace Nancy.Cryptography
{
    using System.Security.Cryptography;

    /// <summary>
    /// Provides key generation using PBKDF2 / Rfc2898
    /// NOTE: this is *not* salted so the password should be long and complicated
    /// (As the bytes are generated at app startup, because it's too slow to do per
    /// request, salting has no benefit)
    /// </summary>
    public class PassphraseKeyGenerator : IKeyGenerator
    {
        private readonly Rfc2898DeriveBytes provider;

        public PassphraseKeyGenerator(string passphrase)
        {
            this.provider = new Rfc2898DeriveBytes(passphrase, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
        }

        /// <summary>
        /// Generate a sequence of bytes
        /// </summary>
        /// <param name="count">Number of bytes to return</param>
        /// <returns>Array <see cref="count"/> bytes</returns>
        public byte[] GetBytes(int count)
        {
            return provider.GetBytes(count);
        }
    }
}<commit_msg>Increased iteration count on PassphraseKeyGenerator<commit_after>﻿namespace Nancy.Cryptography
{
    using System.Security.Cryptography;

    /// <summary>
    /// Provides key generation using PBKDF2 / Rfc2898
    /// NOTE: this is *not* salted so the password should be long and complicated
    /// (As the bytes are generated at app startup, because it's too slow to do per
    /// request, salting has no benefit)
    /// </summary>
    public class PassphraseKeyGenerator : IKeyGenerator
    {
        private readonly Rfc2898DeriveBytes provider;

        public PassphraseKeyGenerator(string passphrase)
        {
            this.provider = new Rfc2898DeriveBytes(passphrase, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 10000);
        }

        /// <summary>
        /// Generate a sequence of bytes
        /// </summary>
        /// <param name="count">Number of bytes to return</param>
        /// <returns>Array <see cref="count"/> bytes</returns>
        public byte[] GetBytes(int count)
        {
            return provider.GetBytes(count);
        }
    }
}
{'fraction_non_alphanumeric': 0.10812064965197216, 'fraction_numerical': 0.021809744779582366, 'mean_word_length': 2.0451977401129944, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4222718', 'n_tokens_mistral': 631, 'n_tokens_neox': 567, 'n_words': 189}