Git Product home page Git Product logo

oalexandrefreire / md5 Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 403 KB

MD5 is a .NET library that provides methods to generate MD5 hash from string content. It has over 150,000 downloads on NuGet and is available under the MIT License. Contributions are welcome!

Home Page: https://oalexandrefreire.github.io/MD5/

License: MIT License

C# 100.00%
csharp csharp-library md5 md5-encode md5-hash netstandard20

md5's Introduction

Nuget Nuget codecov

MD5

NuGet

Overview

MD5 is a .NET library that provides methods to generate MD5 hash from string, byteArray, object or stream content. It uses the System.Security.Cryptography.MD5 class to generate the hash.

Usage

To use the library, you can call the GetMD5 method on a string, byteArray, object or stream to get the MD5 hash. Examples:

string hash1 = "hello world".GetMD5();
// or specific encoding type
string hash2 = "hello world".GetMD5(EncodingType.UTF8);
var stream = File.OpenRead("Rondonia.pdf");
string hash = stream.GetMD5();
byte[] byteArray = Encoding.UTF8.GetBytes("Hello, World!");
string hash = byteArray.GetMD5();
BrasilModel obj = new BrasilModel() { Id = 1, Details = "Maior país da América do Sul" };
string hash = obj.GetMD5();

To number you can use:

string hash = myNumber.ToString().GetMD5():

New Feature: MD5 with Salt

This new feature allows you to generate a salted MD5 hash, enhancing security.

Usage

To use the salted hash functionality, you can call the GetMD5WithSalt method on a string, byteArray, or object to get the MD5 hash with a salt. Examples:

string salt = "randomSalt";
string hash1 = "hello world".GetMD5WithSalt(salt);
// or specific encoding type
string hash2 = "hello world".GetMD5WithSalt(salt, EncodingType.UTF8);
byte[] byteArray = Encoding.UTF8.GetBytes("Hello, World!");
byte[] saltBytes = Encoding.UTF8.GetBytes("randomSalt");
string hash = byteArray.GetMD5WithSalt(saltBytes);
BrasilModel obj = new BrasilModel() { Id = 1, Details = "Maior país da América do Sul" };
string salt = "randomSalt";
string hash = obj.GetMD5WithSalt(salt);

To number you can use:

string salt = "randomSalt";
string hash = myNumber.ToString().GetMD5WithSalt(salt);

Installation

You can install the library via NuGet package manager by searching for MD5 or by executing the following command in the Package Manager Console:

PM> Install-Package MD5

License

This library is licensed under the MIT License. See the LICENSE file for more details.

Contributions

Contributions to this library are welcome. Please open an issue or submit a pull request with your changes.

md5's People

Contributors

oalexandrefreire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jasonmnemonic

md5's Issues

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.