Ejemplo n.º 1
0
 /// <summary>
 /// Generates a salt value that is purely randomized and therefore must be persisted as it cannot be reliably duplicated
 /// </summary>
 /// <returns></returns>
 public string GenerateSalt()
 {
     if (this.model == SaltCreationModel.NonRepeatableStrong)
     {
         return(SaltShaker.GenerateSalt(this.saltLength, this.minChar, this.maxChar, RandomNumberGenerator.Create(), this.suppressedChars));
     }
     else if (this.model == SaltCreationModel.NonRepeatable)
     {
         return(SaltShaker.GenerateSalt(this.saltLength, this.minChar, this.maxChar, new Random(), this.suppressedChars));
     }
     else
     {
         return(SaltShaker.GenerateSalt(this.saltLength, this.minChar, this.maxChar, new Random(this.seed), this.suppressedChars));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Generates a salt value based upon the value of the payload such that the same payload will generate the same salt reliably
 /// </summary>
 /// <param name="payload"></param>
 /// <returns></returns>
 public string GenerateSalt(string payload)
 {
     return(SaltShaker.GenerateSalt(this.saltLength, this.minChar, this.maxChar, payload, this.suppressedChars));
 }