public static void AddCryptography(this IServiceCollection services, Action <CryptographyOptions> cryptographyOptionsBuilder) { var options = new CryptographyOptions(); cryptographyOptionsBuilder(options); services.AddCryptography(options); }
public static void AddCryptography(this IServiceCollection services, CryptographyOptions cryptographyOptions) { services.AddTransient(p => cryptographyOptions); services.AddTransient <ICryptographer, Cryptographer>(); services.AddTransient <HashAlgorithm, SHA256>(p => SHA256.Create()); services.AddTransient <IHasher, Hasher>(); }
public Cryptographer(CryptographyOptions options) : this(options.Password, options.KeySize, options.SaltSize) { }