CSharp examples for System.Security.Cryptography:Salt
Create Salt for Cryptography
using System.Security.Cryptography; using System.Text; using System;/* w w w. j a v a 2 s .co m*/ public class Main{ public static string CreateSalt(int length) { var data = new byte[length]; var salt = new char[length]; new Random().NextBytes(data); for (int i = 0; i < length; i++) { salt[i] = Base64[data[i] & 0x3F]; } return new string(salt); } }