How to define characters to use when creating a salt

Asked

Viewed 30 times

1

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

string usedChars  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

Gero the 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;
    }

Function can be changed to specify characters to be used?

  • 2

    Why limit the salt? Or on the other hand, you could not use a random byte for use in passwords and their representation in Base64 to store and carry?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.