Defining characters to be used in creating a salt

1

I need to generate a salt, but I need all the characters to be part of a list of numbers and letters.

string usedChars  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

I generate salt with this function:

public static byte[] GenerateSalt(int SaltByteLength)
    {
        System.Text.Encoding enc = System.Text.Encoding.ASCII;
        RNGCryptoServiceProvider rncCsp = new RNGCryptoServiceProvider();
        byte[] salt = new byte[SaltByteLength];
        rncCsp.GetBytes(salt);

        return salt;
    }

Is it possible to change the function to indicate the characters to use?

    
asked by anonymous 01.06.2018 / 10:30

0 answers