{"id":26777235,"url":"https://github.com/timothymeadows/blake2b.net","last_synced_at":"2026-01-31T14:32:25.044Z","repository":{"id":257827641,"uuid":"873361275","full_name":"TimothyMeadows/Blake2b.Net","owner":"TimothyMeadows","description":"Blake2b.Net provides an implementation of the cryptographic hash and MAC functions of the BLAKE2b algorithm, optimized for SIMD hardware instructions and PinnedMemory support.","archived":false,"fork":false,"pushed_at":"2024-10-16T04:05:56.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T04:49:13.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimothyMeadows.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-16T03:20:33.000Z","updated_at":"2024-10-16T04:05:59.000Z","dependencies_parsed_at":"2024-10-17T14:30:56.349Z","dependency_job_id":null,"html_url":"https://github.com/TimothyMeadows/Blake2b.Net","commit_stats":null,"previous_names":["timothymeadows/blake2b.net"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyMeadows%2FBlake2b.Net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyMeadows%2FBlake2b.Net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyMeadows%2FBlake2b.Net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimothyMeadows%2FBlake2b.Net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimothyMeadows","download_url":"https://codeload.github.com/TimothyMeadows/Blake2b.Net/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249192391,"owners_count":21227774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T04:49:16.908Z","updated_at":"2026-01-31T14:32:25.038Z","avatar_url":"https://github.com/TimothyMeadows.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Blake2b.Net\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![nuget](https://img.shields.io/nuget/v/Blake2b.Net.svg)](https://www.nuget.org/packages/Blake2b.Net/)\n\nBlake2b.Net provides an implementation of the cryptographic hash and MAC functions of the [BLAKE2b](https://tools.ietf.org/html/draft-saarinen-blake2-02) algorithm, optimized for SIMD hardware instructions and [PinnedMemory](https://github.com/TimothyMeadows/PinnedMemory) support.\n\n## Features\n- Supports cryptographic hash generation using BLAKE2b.\n- MAC (Message Authentication Code) functionality with key and salt.\n- Optimized for SIMD instructions to ensure fast performance on supported hardware.\n- Secure key and buffer management with PinnedMemory to avoid sensitive data leaks.\n\n## Installation\n\nYou can install the package via NuGet:\n\n### .NET CLI\n```bash\ndotnet add package Blake2b.Net\n```\n\n### Package Manager\n```bash\nInstall-Package Blake2b.Net\n```\n\n### NuGet Website\nYou can also search for and install the package via the NuGet UI or from the following link:\n[Blake2b.Net on NuGet](https://www.nuget.org/packages/Blake2b.Net/)\n\n## Usage Examples\n\n### Hashing Example:\n```csharp\nvar digest = new Blake2b();\nusing var exampleHash = new PinnedMemory\u003cbyte\u003e(new byte[digest.GetLength()]);\ndigest.UpdateBlock(new PinnedMemory\u003cbyte\u003e(new byte[] {63, 61, 77, 20, 63, 61, 77, 20, 63, 61, 77}, false), 0, 11);\ndigest.DoFinal(exampleHash, 0);\n```\n\n### MAC Example:\n```csharp\nvar digest = new Blake2bMac(new PinnedMemory\u003cbyte\u003e(new byte[] {63, 61, 77, 20, 63, 61, 77}, false));\nusing var exampleHash = new PinnedMemory\u003cbyte\u003e(new byte[digest.GetLength()]);\ndigest.UpdateBlock(new PinnedMemory\u003cbyte\u003e(new byte[] {63, 61, 77, 20, 63, 61, 77, 20, 63, 61, 77}, false), 0, 11);\ndigest.DoFinal(exampleHash, 0);\n```\n\n## API Documentation\n\n### Constructors\n\n#### `Blake2b(int digestSize = 512)`\n- Initializes a new instance of the `Blake2b` class with the specified digest size.\n- Supported digest sizes: 160, 256, 384, 512 bits.\n- Default size: 512 bits.\n\n#### `Blake2bMac(PinnedMemory\u003cbyte\u003e key)`\n- Initializes a new instance of the `Blake2bMac` class with the specified key for MAC generation.\n- The key should be provided in the form of a `PinnedMemory\u003cbyte\u003e` object.\n\n#### `Blake2bMac(PinnedMemory\u003cbyte\u003e key, byte[] salt, int digestSize = 512)`\n- Initializes a new instance of the `Blake2bMac` class with the specified key, salt, and digest size.\n- Supported digest sizes: 160, 256, 384, 512 bits.\n- Default size: 512 bits.\n- The salt must be 16 bytes long.\n\n### Methods\n\n#### `void Update(byte b)`\n- Updates the message digest with a single byte.\n\n#### `void UpdateBlock(PinnedMemory\u003cbyte\u003e message, int offset, int len)`\n- Updates the message digest with a pinned memory byte array.\n\n#### `void UpdateBlock(byte[] message, int offset, int len)`\n- Updates the message digest with a regular byte array.\n\n#### `void DoFinal(PinnedMemory\u003cbyte\u003e output, int outOffset)`\n- Produces the final digest value and outputs it to the specified `PinnedMemory\u003cbyte\u003e` buffer.\n\n#### `void Reset()`\n- Resets the digest to its initial state for further processing.\n- The key and salt remain until the object is disposed.\n\n#### `void Dispose()`\n- Clears the key and salt, resets the digest to its initial state, and releases resources.\n\n## Performance Considerations\n\nThe BLAKE2b algorithm is optimized for modern SIMD instructions (such as AVX and SSE) to provide enhanced performance on supported hardware. This ensures that hashing and MAC operations are processed efficiently, even with large datasets.\n\n## Security Considerations\n\nThis library utilizes `PinnedMemory` to ensure that sensitive data such as keys and message buffers are not moved by the garbage collector, reducing the risk of memory leaks. Ensure that you call `Dispose()` on any `PinnedMemory` object or classes that use it to securely clear and free memory after use.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimothymeadows%2Fblake2b.net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimothymeadows%2Fblake2b.net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimothymeadows%2Fblake2b.net/lists"}