Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
oalexandrefreire committed Mar 6, 2024
1 parent 0edc9d2 commit 0af3438
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions MD5CSharp/MD5.csproj
Expand Up @@ -11,13 +11,14 @@
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
<RepositoryUrl>https://github.com/oalexandrefreire/MD5</RepositoryUrl>
<Version>2.0.4</Version>
<Version>2.0.5</Version>
<RepositoryType>git</RepositoryType>
<AssemblyVersion>2.0.5</AssemblyVersion>
<FileVersion>2.0.5</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/oalexandrefreire/MD5</PackageProjectUrl>
<PackageReleaseNotes>added suport to byteArray and stream</PackageReleaseNotes>
<PackageReleaseNotes>added suport to objects
removed duplicated codes from Hash.cs</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions README.md
@@ -1,4 +1,4 @@
![Nuget](https://img.shields.io/nuget/dt/md5)
![Nuget](https://img.shields.io/nuget/dt/md5)
![Nuget](https://img.shields.io/nuget/v/md5)

# MD5
Expand All @@ -7,15 +7,17 @@

## Overview

MD5 is a .NET library that provides methods to generate MD5 hash from string, byteArray or stream content. It uses the System.Security.Cryptography.MD5 class to generate the hash.
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 or stream to get the MD5 hash.
To use the library, you can call the `GetMD5` method on a string, byteArray, object or stream to get the MD5 hash.
Examples:

```csharp
string hash = "hello world".GetMD5();
string hash1 = "hello world".GetMD5();
// or specific encoding type
string hash2 = "hello world".GetMD5(EncodingType.UTF8);
```
```csharp
var stream = File.OpenRead("Rondonia.pdf");
Expand All @@ -25,17 +27,15 @@ string hash = stream.GetMD5();
byte[] byteArray = Encoding.UTF8.GetBytes("Hello, World!");
string hash = byteArray.GetMD5();
```
To number you can use:
```csharp
string hash = myNumber.ToString().GetMD5():
BrasilModel obj = new BrasilModel() { Id = 1, Details = "Maior país da América do Sul" };
string hash = obj.GetMD5();
```
You can also call the Content method on the MD5Hash.Hash class to get the hash from a string, byteArray or Stream

To number you can use:
```csharp
string hash = MD5Hash.Hash.Content("hello world");
string hash = myNumber.ToString().GetMD5():
```


## 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:

Expand Down

0 comments on commit 0af3438

Please sign in to comment.