Skip to content

Commit e0c69fe

Browse files
committed
readme fix'
1 parent 400ff37 commit e0c69fe

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Readme.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ string decryptedText = Encoding.UTF8.GetString(outputStream.ToArray());
104104
encrypting emails in your software and also want that emails to be unique. With our Aes256 class by default your
105105
emails will be unique as in front will be the unique hash.
106106

107-
108107
### Argon2id Class
109108

110109
**Default Configurations**
@@ -149,22 +148,24 @@ bool isValid = Password.Validate(password, 16, includeUppercase, includeLowercas
149148

150149
### Sha2 Class
151150

152-
The `Sha2` class simplifies HMAC-SHA256 operations by offering byte array, hex, and Base64 outputs.
151+
The `Sha2` class simplifies HMAC-SHA256 operations by offering byte array, hex, and Base64 outputs. It also hat params
152+
string[] where the method automatically concatenates all strings and then computes the hash.
153153

154154
```csharp
155155
// Prepare the key and message
156-
var key = Encoding.UTF8.GetBytes("your-secret-key");
157-
var message = "HelloWorld";
156+
var key = Encoding.UTF8.GetBytes("secret");
157+
var message1 = "Hello";
158+
var message2 = "World";
158159

159160
// Compute HMAC-SHA256 as a byte array
160-
byte[] hashBytes = Sha2.ComputeHmacSha256(key, message);
161+
byte[] hashBytes = Sha2.ComputeHmacSha256(key, message1, message2);
161162

162163
// Get HMAC-SHA256 as a hex string
163-
string hexHash = Sha2.GetHmacSha256Hex(key, message);
164+
string hexHash = Sha2.GetHmacSha256Hex(key, message1, message2);
164165
// Output: 2e91612bb72b29d82f32789d063de62d5897a4ee5d3b5d34459801b94397b099
165166
166167
// Get HMAC-SHA256 as a Base64 string
167-
string base64Hash = Sha2.GetHmacSha256Base64(key, message);
168+
string base64Hash = Sha2.GetHmacSha256Base64(key, message1, message2);
168169
// Output: LpFhK7crKdgvMnidBj3mLViXpO5dO100RZgBuUOXsJk=
169170
```
170171

src/Pandatech.Crypto/Pandatech.Crypto.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
<Copyright>MIT</Copyright>
99
<PackageIcon>pandatech.png</PackageIcon>
1010
<PackageReadmeFile>Readme.md</PackageReadmeFile>
11-
<Version>2.6.0</Version>
11+
<Version>2.6.1</Version>
1212
<Title>Pandatech.Crypto</Title>
1313
<PackageTags>Pandatech, library, encryption, hash, algorythms, security</PackageTags>
1414
<Description>PandaTech.Crypto is a .NET library simplifying common cryptograhic functions.</Description>
1515
<RepositoryUrl>https://github.com/PandaTechAM/be-lib-pandatech-crypto</RepositoryUrl>
16-
<PackageReleaseNotes>HMAC-SHA256 support added</PackageReleaseNotes>
16+
<PackageReleaseNotes>Readme fix</PackageReleaseNotes>
1717
</PropertyGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)