{"id":22683101,"url":"https://github.com/mcraiha/csharp-aes-ctr-netstandard","last_synced_at":"2025-04-12T18:13:17.614Z","repository":{"id":55138257,"uuid":"159068393","full_name":"mcraiha/CSharp-AES-CTR-NetStandard","owner":"mcraiha","description":"Managed .Net (.NET 8) compatible AES-CTR Cipher implementation in C#","archived":false,"fork":false,"pushed_at":"2024-12-08T14:20:06.000Z","size":121,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T18:13:11.086Z","etag":null,"topics":["aes-ctr","csharp","csharp-library","net8"],"latest_commit_sha":null,"homepage":"https://mcraiha.github.io/CSharp-AES-CTR-NetStandard/index.html","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcraiha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-25T19:50:01.000Z","updated_at":"2024-12-08T14:20:10.000Z","dependencies_parsed_at":"2023-01-22T17:01:02.416Z","dependency_job_id":null,"html_url":"https://github.com/mcraiha/CSharp-AES-CTR-NetStandard","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcraiha%2FCSharp-AES-CTR-NetStandard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcraiha%2FCSharp-AES-CTR-NetStandard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcraiha%2FCSharp-AES-CTR-NetStandard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcraiha%2FCSharp-AES-CTR-NetStandard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcraiha","download_url":"https://codeload.github.com/mcraiha/CSharp-AES-CTR-NetStandard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610341,"owners_count":21132919,"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":["aes-ctr","csharp","csharp-library","net8"],"created_at":"2024-12-09T21:10:07.810Z","updated_at":"2025-04-12T18:13:17.596Z","avatar_url":"https://github.com/mcraiha.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp-AES-CTR-NetStandard\n\nManaged .Net (.NET 8) compatible [AES-CTR](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_(CTR)) cipher written in C# (using [Aes.Create](hhttps://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.aes.create?view=net-8.0#system-security-cryptography-aes-create) for AES operations)\n\n## Build status\n\n![.NET](https://github.com/mcraiha/CSharp-AES-CTR-NetStandard/workflows/.NET/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/0b754630aa9b47109afbd7d0a7f3c10e)](https://www.codacy.com/gh/mcraiha/CSharp-AES-CTR-NetStandard/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=mcraiha/CSharp-AES-CTR-NetStandard\u0026utm_campaign=Badge_Coverage)\n\n## Why?\n\nBecause I needed this for my personal project\n\n## Older versions\n\nYOu can find OLD .NET Standard and .NET 6 compatible version from [older branch](https://github.com/mcraiha/CSharp-AES-CTR-NetStandard/tree/netstandard20andnet6)\n\n## Documentation\n\n[Docs](https://mcraiha.github.io/CSharp-AES-CTR-NetStandard/api/index.html)\n\n\n## How do I use this?\n\nEither copy the [CSAES-CTR.cs](src/CSAES-CTR.cs) to your project or use [LibAES-CTR](https://www.nuget.org/packages/LibAES-CTR/) nuget package\n\nThen do code like\n```csharp\nusing CS_AES_CTR;\n\nbyte[] mySimpleTextAsBytes = Encoding.ASCII.GetBytes(\"Plain text I want to encrypt\");\n\n// In real world, generate these with cryptographically secure pseudo-random number generator (CSPRNG)\nbyte[] key = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };\nbyte[] initialCounter = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 };\n\n// Encrypt\nAES_CTR forEncrypting = new AES_CTR(key, initialCounter);\t\t\t\nbyte[] encryptedContent = new byte[mySimpleTextAsBytes.Length];\nforEncrypting.EncryptBytes(encryptedContent, mySimpleTextAsBytes);\n\n// Decrypt\nAES_CTR forDecrypting = new AES_CTR(key, initialCounter);\nbyte[] decryptedContent = new byte[encryptedContent.Length];\nforDecrypting.DecryptBytes(decryptedContent, encryptedContent);\n\n```\n\nYou can try out the code in [.NET Fiddle](https://dotnetfiddle.net/mtvYHv)\n\n## Test cases\n\nYou can run test cases by moving to **tests** folder and running following command\n```bash\ndotnet test\n```\n\n## Benchmarks\n\nYou can run benchmarks (which compare this implementation to the original version) by moving to **benchmarks** folder and running following command\n```bash\ndotnet run -c Release\n```\n\nthere are three different input sizes (64 bytes, 1024 bytes and 1 MiB) and comparisons are done between code from [Stack Overflow](https://stackoverflow.com/a/51188472/4886769) (made by **Martin Prikryl**) and this project\n\n## License\n\nAll the code in [src](src) and [tests](tests) folders are licensed under [Unlicense](LICENSE). SO sample [code file](benchmarks/SO_AES.cs) (which is only used during benchmarking) is licensed under cc-wiki (aka cc-by-sa) license, see https://stackoverflow.blog/2009/06/25/attribution-required/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcraiha%2Fcsharp-aes-ctr-netstandard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcraiha%2Fcsharp-aes-ctr-netstandard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcraiha%2Fcsharp-aes-ctr-netstandard/lists"}