{"id":28329286,"url":"https://github.com/grey-workers-togo/securepasswordcrypt","last_synced_at":"2026-02-27T12:34:08.295Z","repository":{"id":286374142,"uuid":"961204308","full_name":"Grey-Workers-Togo/SecurePasswordCrypt","owner":"Grey-Workers-Togo","description":"Secure AES-GCM encryption and password hashing utility for and C# .NET projects.","archived":false,"fork":false,"pushed_at":"2025-04-06T04:07:17.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T21:20:39.870Z","etag":null,"topics":["aes","crypto","csharp","dotnet","encryption","nuget","password-hashing"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/SecurePasswordCrypt","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/Grey-Workers-Togo.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":"2025-04-06T01:39:00.000Z","updated_at":"2025-05-19T22:58:50.000Z","dependencies_parsed_at":"2025-04-09T22:38:31.563Z","dependency_job_id":null,"html_url":"https://github.com/Grey-Workers-Togo/SecurePasswordCrypt","commit_stats":null,"previous_names":["alwil17/securepasswordcrypt","grey-workers-togo/securepasswordcrypt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Grey-Workers-Togo/SecurePasswordCrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grey-Workers-Togo%2FSecurePasswordCrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grey-Workers-Togo%2FSecurePasswordCrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grey-Workers-Togo%2FSecurePasswordCrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grey-Workers-Togo%2FSecurePasswordCrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Grey-Workers-Togo","download_url":"https://codeload.github.com/Grey-Workers-Togo/SecurePasswordCrypt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grey-Workers-Togo%2FSecurePasswordCrypt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261766636,"owners_count":23206664,"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","crypto","csharp","dotnet","encryption","nuget","password-hashing"],"created_at":"2025-05-26T11:11:16.230Z","updated_at":"2026-02-27T12:34:08.286Z","avatar_url":"https://github.com/Grey-Workers-Togo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SecurePasswordCrypt\n\nA secure and reusable C# library that provides password hashing, AES-GCM encryption, and password verification. Useful for scenarios where storing or using plaintext passwords (e.g., in connection strings) is a risk.\n\n## Features\n\n- AES-GCM encryption with authentication tag\n- PBKDF2 (Rfc2898) key derivation\n- SHA-256-based password hashing\n- Secure password verification (constant time)\n- Easy-to-integrate as a class library or NuGet package\n- Fully self-contained, no external dependencies\n\n---\n\n## Installation\n\n### Option 1: Add as Project Reference (only if you have access to source code)\n\n```bash\ndotnet add reference ../SecurePasswordCrypt/SecurePasswordCrypt.csproj\n```\n\n### Option 2: Use as NuGet Package\n\n```bash\ndotnet add package SecurePasswordCrypt\n```\n\n## How It Works\n### AES-GCM Encryption\nAES-GCM is used for encrypting plaintext securely using:\n- Random 128-bit salt\n- Random 96-bit nonce\n- 100,000 PBKDF2 iterations for key derivation\n- Authentication tag for tamper protection\n\nThe result is encoded as Base64, containing:\n\n```csharp\n[salt | nonce | tag | ciphertext]\n```\n\n### Password Hashing\nPasswords are hashed using PBKDF2 (HMAC-SHA256) and stored in the format:\n\n```csharp\n[salt + derived key] as Base64\n```\n\nThis can be verified later using constant-time comparison.\n\n---\n\n## Example Usage\n### Encrypt / Decrypt a password or connection string\n```csharp\nstring plainText = \"MySecretPassword!\";\nstring password = \"SuperSecureKey123\";\n\nstring encrypted = CryptoService.Encrypt(plainText, password);\nstring decrypted = CryptoService.Decrypt(encrypted, password);\n```\n\n### Hash a password (for storage)\n```csharp\nstring password = \"user_password\";\nstring hashed = CryptoService.HashPassword(password);\n\n// Save to DB\n```\n\n### Verify a user login\n```csharp\nbool isValid = CryptoService.VerifyPassword(\"user_input\", storedHash);\n```\n\n## API Overview\n```csharp\npublic static class CryptoService\n{\n    string Encrypt(string plaintext, string password)\n    string Decrypt(string base64CipherText, string password)\n    string HashPassword(string password)\n    bool   VerifyPassword(string password, string storedHash)\n}\n```\n\n## Use Cases\n- Secure connection strings for background jobs or CI/CD\n- Encrypted configuration values\n- Custom authentication flows\n- Secrets stored in local config (securely)\n\n## Security Notes\n- Never hard-code encryption keys or passwords\n- Store secrets using secure mechanisms (e.g., environment variables, vaults)\n- Always use a unique salt per password\n- Don't use this library for token signing (use asymmetric keys instead)\n\n## Author\nDeveloped by [Alwil17](https://github.com/Alwil17) � feel free to fork, improve, and share!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrey-workers-togo%2Fsecurepasswordcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrey-workers-togo%2Fsecurepasswordcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrey-workers-togo%2Fsecurepasswordcrypt/lists"}