Long story short, EntLib is a legacy library created over a decade ago. Don't use it. It was never meant to be used in .NET Core and obviously, never upgraded to work with it. Use KeyDerivation.Pbkdf2 instead.
In this specific case you can't use EntLib at all because it tries to use a non-existent property, AppDomain.SetupInformation. The AppDomain class was removed in the first versions of .NET Core and added back i .NET Core 2.0. Even now, it doesn't offer all members, including SetupInformation
.
As the documentation page explains, this property will be added back in .NET Core 3.0, due to be released in September.
The real solution is to not use such code in the first place, and use ASP.NET Core's Identity to store passwords.
Hashing a password with SHA1 like this is trivial to break in minutes if not less. Way back when people used to create rainbow tables, pre-calculated SHA1 hashes for all password combinations and just lookup a hash to find the password. Nowadays, it's probably faster to just brute-force it than search a big table of hashes.
ASP.NET always provided far more secure password hashing and storage that included salting and multiple hash iterations. In ASP.NET Web Forms and older versions of MVC, salting and at least 1000 hash iterations were used.
ASP.NET Core Identity also offers secure hashing and storage. Using it is the easiest and most secure option. It's open source, so even if one can't use it, it's easy to check how it hashes passwords.
The HashPasswordV3 method uses ASP.NET Core's KeyDerivation class to hash a user-supplied password. The code is very simple. Essentially, it's a call to KeyDerivation.Pbkdf2 with a 16-byte salt that returns a 32-byte hash buffer.
byte[] salt = new byte[16];
rng.GetBytes(salt);
byte[] subkey = KeyDerivation.Pbkdf2(password, salt, KeyDerivationPrf.HMACSHA256,
iterCount, 32);
The rest of the code packs the hash algorithm ID, hash bytes, iteration count and salt in a single byte array for storage in a table. Those attributes could be stored in different columns in the table, but putting everything in a single byte[] array is more convenient.
The VerifyHashedPasswordV3 later on reads the stored buffer, extracts the attributes and hashes the provided password before checking the stored and calculated hashes