{"id":20848352,"url":"https://github.com/emako/blufidh","last_synced_at":"2026-01-22T20:10:11.150Z","repository":{"id":257821333,"uuid":"871039032","full_name":"emako/BlufiDH","owner":"emako","description":"A fast Diffie-Hellman key exchange algorithm","archived":false,"fork":false,"pushed_at":"2024-10-11T06:55:04.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T05:59:52.738Z","etag":null,"topics":["blufi","dh","diffie-hellman"],"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/emako.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-11T06:37:53.000Z","updated_at":"2024-10-11T06:52:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"615c0bda-af49-4bd1-baa8-8e2b7ba4de24","html_url":"https://github.com/emako/BlufiDH","commit_stats":null,"previous_names":["emako/blufidh"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/emako/BlufiDH","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FBlufiDH","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FBlufiDH/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FBlufiDH/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FBlufiDH/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emako","download_url":"https://codeload.github.com/emako/BlufiDH/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emako%2FBlufiDH/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28670366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T19:36:09.361Z","status":"ssl_error","status_checked_at":"2026-01-22T19:36:05.567Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["blufi","dh","diffie-hellman"],"created_at":"2024-11-18T02:25:40.757Z","updated_at":"2026-01-22T20:10:11.134Z","avatar_url":"https://github.com/emako.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/BlufiDH.svg)](https://nuget.org/packages/BlufiDH) [![GitHub license](https://img.shields.io/github/license/emako/BlufiDH)](https://github.com/emako/BlufiDH/blob/master/LICENSE) [![Actions](https://github.com/emako/BlufiDH/actions/workflows/library.nuget.yml/badge.svg)](https://github.com/emako/BlufiDH/actions/workflows/library.nuget.yml)\n\n# BlufiDH\n\nA fast Diffie-Hellman key exchange algorithm in `.NET Standard 1.1` and `.NET 6`.\n\n## Example\n\n```c#\nconst string DH_P = \"cf5cf5c38419a724957ff5dd323b9c45c3cdd261eb740f69aa94b8bb1a5c9640\" +\n    \"9153bd76b24222d03274e4725a5406092e9e82e9135c643cae98132b0d95f7d6\" +\n    \"5347c68afc1e677da90e51bbab5f5cf429c291b4ba39c6b2dc5e8c7231e46aa7\" +\n    \"728e87664532cdf547be20c9a3fa8342be6e34371a27c06f7dc0edddd2f86373\";\nconst string DH_G = \"2\";\nconst int radix = 16;\nconst int dhLength = 1024;\nBigInteger dhG = BigInteger.Parse(DH_G);\nBigInteger dhP = RadixBigInteger.Parse(DH_P, radix);\n\nBlufiDH appDH = new(dhG, dhP, dhLength);\nBlufiDH espDH = new(dhG, dhP, dhLength);\n\nBigInteger A = appDH.GetPublicKey();\nBigInteger B = espDH.GetPublicKey();\n\nBigInteger keyA = appDH.GenerateSecretKey(B);\nConsole.WriteLine($\"APP computed key: {keyA}\");\n\nBigInteger keyB = espDH.GenerateSecretKey(A);\nConsole.WriteLine($\"ESP computed key: {keyB}\");\n\nif (keyA == keyB)\n{\n    Console.WriteLine(\"Key exchange successful! Both parties have the same shared key.\");\n}\nelse\n{\n    Console.WriteLine(\"Key exchange failed! The keys do not match.\");\n}\n```\n\n## DH Negotiate Security\n\n```startuml\n@startuml DH Negotiate Security\n\nparticipant APP as a\nparticipant ESP as b\n\nactivate a\n\na -[#Green]\u003e a: Generate g, p\na -[#Green]\u003e a: Private key: a\na -[#Green]\u003e a: Public key: A = g^a mod p\na -[#Blue]\u003e b: Send: A, g, p\n\nactivate b\n\nb -[#Green]\u003e b: Private key: b\nb -[#Green]\u003e b: Public key: B = g^b mod p\nb -[#Blue]\u003e a: Send: B\nb -[#DarkRed]\u003e b: Shared key: K = A^b mod p\n\nactivate a\n\na -[#DarkRed]\u003e a: Shared key: K = B^a mod p\n\n@enduml\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/emako/BlufiDH/refs/heads/master/assets/DH%20Negotiate%20Security.png\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femako%2Fblufidh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femako%2Fblufidh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femako%2Fblufidh/lists"}