{"id":22205198,"url":"https://github.com/kenkendk/fasterhashing","last_synced_at":"2025-07-27T06:30:23.733Z","repository":{"id":144199971,"uuid":"104472601","full_name":"kenkendk/FasterHashing","owner":"kenkendk","description":"Wrapper library for using native hashing libraries on Windows, Linux and OSX","archived":false,"fork":false,"pushed_at":"2022-12-02T10:36:56.000Z","size":3522,"stargazers_count":3,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-08T22:53:14.023Z","etag":null,"topics":["csharp","dotnet","hashing","md5","sha1","sha256","sha384","sha512"],"latest_commit_sha":null,"homepage":null,"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/kenkendk.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":"2017-09-22T12:36:02.000Z","updated_at":"2023-07-10T07:06:51.000Z","dependencies_parsed_at":"2023-06-17T03:15:25.536Z","dependency_job_id":null,"html_url":"https://github.com/kenkendk/FasterHashing","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenkendk%2FFasterHashing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenkendk%2FFasterHashing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenkendk%2FFasterHashing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenkendk%2FFasterHashing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenkendk","download_url":"https://codeload.github.com/kenkendk/FasterHashing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227771127,"owners_count":17817457,"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":["csharp","dotnet","hashing","md5","sha1","sha256","sha384","sha512"],"created_at":"2024-12-02T17:27:36.765Z","updated_at":"2024-12-02T17:27:39.245Z","avatar_url":"https://github.com/kenkendk.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FasterHashing\n[![Nuget count](https://img.shields.io/nuget/v/FasterHashing.svg)](https://www.nuget.org/packages/FasterHashing/)\n[![License](https://img.shields.io/github/license/kenkendk/FasterHashing.svg)](https://github.com/kenkendk/FasterHashing/blob/master/LICENSE)\n[![Issues open](https://img.shields.io/github/issues-raw/kenkendk/FasterHashing.svg)](https://github.com/kenkendk/FasterHashing/issues/)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e55381f49cb474ab04201e63b840043)](https://www.codacy.com/manual/kenneth/FasterHashing?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=kenkendk/FasterHashing\u0026amp;utm_campaign=Badge_Grade)\n\nFasterHashing is a wrapper library for using native hashing libraries on Windows, Linux and OSX.\n\nThis library addresses a limitation in the current .Net standard profile where [`HashAlgorithm.Create()`](https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.create(v=vs.110).aspx) always returns the managed versions of the algorithm, even if faster versions exist on the system.\n\nThe problem with `HashAlgorithm.Create()` has been [fixed with the .Net Core 2 profile](https://blogs.msdn.microsoft.com/dotnet/2017/06/07/performance-improvements-in-net-core/), so if you are using that, you will not benefit from this library. \nUnfortunately, the implementation for .Net Core 2 relies on a Platform Abstraction Layer, which is a glue library that links into the system libraries.\nThis glue library needs to be complied for the target platform, making it difficult to deploy this with platform independent projects (i.e. using only managed code).\n\nFor this reason *FasterHashing* contains only managed code. If you are using the .Net standard profile (v4.5+) you can simply add this library to your project, change the call from `HashAlgorithm.Create(\"SHA256\")` to `FasterHash.Create(\"SHA256\")` and obtain speedups on all supported platforms while falling back to the managed implementation if none are found.\n\n## Installation\nThe [FasterHashing NuGet package](https://www.nuget.org/packages/FasterHashing) is the recommended way of installing FasterHashing:\n```bash\nPM\u003e Install-Package FasterHashing\n```\n\n## Supported libraries\nThese libraries are probed for at runtime in this order\n*   Windows Cryptography Next Generation (CNG)\n*   Apple Common Crypto\n*   OpenSSL with version 1.1 API\n*   OpenSSL with version 1.0 API\n\n## Example\nThe returned item from `FasterHash.Create()` is a normal `HashAlgorithm` object, so you can easily replace existing code that uses such an instance.\n```csharp\nusing FasterHashing;\n\npublic static void Main(string[] args) \n{\n  using(var sha256 = FasterHash.Create(\"SHA256\"))\n    Console.WriteLine(Convert.ToBase64(sha256.ComputeHash(new byte[] { 0, 1, 2, 3 }));\n}\n```\n\n## Advanced usage\nIf you want to control which of the library is loaded, you can use some of the utility methods on the static `FasterHash` class:\n```csharp\nusing FasterHashing;\n\npublic static void Main(string[] args) \n{\n  Console.WriteLine(\"Optimal implementation is: {0}\", FasterHash.PreferedImplementation);\n  Console.WriteLine(\"Is Apple Common Crypto Supported: {0}\", \n    FasterHash.SupportsImplementation(HashImplementation.AppleCommonCrypto));\n  \n  // Manually choose OpenSSL 1.0 version:\n  using(var sha256 = FasterHash.Create(\"SHA256\", HashImplementation.OpenSSL10))\n  { }\n  \n  // Set which version to use:\n  FasterHash.PreferedImplementation = HashImplementation.CNG;\n  \n  // Or run a benchmark to get the fastest:\n  FasterHash.SetDefaultImplementationToFastest();\n}\n\n```\n\n## Configure with OpenSSL\nFasterHashing will automatically detect various names for OpenSSL, such as `libssl.so`, `libssl.so.1.0.0`. It will also detect the `libeay32.dll` and `libcrypto-1.1.dll` names on Windows. \n\nIf this detection fails for some reason, there are two ways to fix it:\n\n1.  Make a symlink in `/lib/libssl.so` that points to the fully versioned filename.\n2.  Use an [assembly config file](https://github.com/kenkendk/FasterHashing/blob/master/FasterHashing.dll.config) that remaps to the correct filename.\n\nOption (1) is the simplest, but may require root access.\n\nOption (2) only requires that you add a separate file to the folder where `FasterHashing.dll` is located, and put in the correct filename. You can probably copy the [example assembly config file](https://github.com/kenkendk/FasterHashing/blob/master/FasterHashing.dll.config) directly into the target folder.\n\nOn Windows, option (2) does not work, but you can optionally drop in the `.dll` file into the same folder where the main executable is, and rename it to `libssl.dll` and it will be loaded.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenkendk%2Ffasterhashing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenkendk%2Ffasterhashing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenkendk%2Ffasterhashing/lists"}