Giter Site home page Giter Site logo

.NET Core about simplecrypto.net HOT 4 CLOSED

stanislavromanov avatar stanislavromanov commented on July 18, 2024
.NET Core

from simplecrypto.net.

Comments (4)

martinjt avatar martinjt commented on July 18, 2024

Why don't you do a pull request? I'd like to see this too.

from simplecrypto.net.

stanislavromanov avatar stanislavromanov commented on July 18, 2024

I don't know how to convert this to .net core. I know only how to create new .net core package

from simplecrypto.net.

geersch avatar geersch commented on July 18, 2024

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.

stanislavromanov avatar stanislavromanov commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.