Comments (4)
Why don't you do a pull request? I'd like to see this too.
from simplecrypto.net.
I don't know how to convert this to .net core. I know only how to create new .net core package
from simplecrypto.net.
Old thread, but it might help somebody in the future. Came across this package when porting some old code to .NET core.
It's not that much work to rewrite it.
First you need to install the Microsoft.AspNetCore.Cryptography.KeyDerivation
package.
To hash a password:
string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2(
password: password,
salt: Encoding.UTF8.GetBytes(salt),
prf: KeyDerivationPrf.HMACSHA1,
iterationCount: iterationCount,
numBytesRequested: 64
));
To compare it against a stored hashed password.
var equal = string.Compare(hashedPassword1, hashedPassword2) == 0;
You can also port the compare function from this library and use that instead.
And finally if you want to generate a salt.
byte[] salt = new byte[128 / 8];
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(salt);
}
var base64salt = Convert.ToBase64String(salt);
from simplecrypto.net.
Apparently I already did rewrite it 4 years ago (https://www.nuget.org/packages/SimpleCrypto.NetCore). From my comment it seemed that I did not know how to convert this existing project to .NET Core package so instead I just created a new one!
Could you do a PR then?
from simplecrypto.net.
Related Issues (10)
- extraneous code in PBKDF2 HOT 1
- Default salt size and iterations HOT 4
- major issue with entropy in randompasswordgenerator
- PBKDF2.Compare assumes equal string lengths HOT 1
- pbkdf2 output size too high HOT 1
- no code signed package available
- buggy salt to byte array conversion HOT 1
- Get password value back HOT 1
- .Compare() returns true for empty string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplecrypto.net.