{"id":29019193,"url":"https://github.com/ydv-ankit/file-encryptor","last_synced_at":"2025-06-26T00:08:28.587Z","repository":{"id":301159648,"uuid":"1008347239","full_name":"ydv-ankit/file-encryptor","owner":"ydv-ankit","description":"A complete implementation of TEA (Tiny Encryption Algorithm) encryption and decryption for files.","archived":false,"fork":false,"pushed_at":"2025-06-25T12:46:00.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-25T13:19:32.568Z","etag":null,"topics":["cicd","cli-app","cryptography","gh-actions","golang","tiny-encryption-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ydv-ankit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-06-25T12:02:23.000Z","updated_at":"2025-06-25T12:52:06.000Z","dependencies_parsed_at":"2025-06-25T13:29:40.995Z","dependency_job_id":null,"html_url":"https://github.com/ydv-ankit/file-encryptor","commit_stats":null,"previous_names":["ydv-ankit/file-encryptor"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ydv-ankit/file-encryptor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydv-ankit%2Ffile-encryptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydv-ankit%2Ffile-encryptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydv-ankit%2Ffile-encryptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydv-ankit%2Ffile-encryptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ydv-ankit","download_url":"https://codeload.github.com/ydv-ankit/file-encryptor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ydv-ankit%2Ffile-encryptor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261973746,"owners_count":23238588,"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":["cicd","cli-app","cryptography","gh-actions","golang","tiny-encryption-algorithm"],"created_at":"2025-06-26T00:08:24.064Z","updated_at":"2025-06-26T00:08:28.551Z","avatar_url":"https://github.com/ydv-ankit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File-System Symmetric Encryptor (TEA)\n\nA complete implementation of TEA (Tiny Encryption Algorithm) encryption and decryption for files.\n\n## Workflow\n\u003cimg width=\"1485\" alt=\"Screenshot 2025-06-25 at 18 51 43\" src=\"https://github.com/user-attachments/assets/78cc9342-4263-4073-8b4c-e36f33f36a7e\" /\u003e\n\n## Features\n\n- **TEA Encryption/Decryption**: Full implementation of the Tiny Encryption Algorithm\n- **File-based Operations**: Encrypt and decrypt entire files\n- **Custom Key Support**: Use your own key files (converted to 128-bit hash)\n- **Block Processing**: Handles files of any size by processing in 8-byte blocks\n- **Automatic Padding**: Handles files that aren't multiples of 8 bytes\n- **SHA-256 Key Hashing**: Converts any key file to a 128-bit hash for consistent key size\n\n## How it Works\n\nThe implementation follows the standard TEA algorithm:\n\n1. **Key Processing**: Converts input key to SHA-256 hash and uses first 16 bytes\n2. **Block Processing**: Processes data in 8-byte blocks\n3. **Encryption**: 32 rounds of TEA encryption with delta constant\n4. **Padding**: Automatically adds null bytes to make data length multiple of 8\n5. **Decryption**: 32 rounds of TEA decryption with automatic padding removal\n\n### Core Components\n\n- **TEA Algorithm**: Complete implementation of Tiny Encryption Algorithm\n- **Key Hashing**: SHA-256 hashing for consistent 128-bit keys\n- **Block Processing**: 8-byte block encryption/decryption\n- **Padding Management**: Automatic padding during encryption and removal during decryption\n\n## Usage\n\n### Basic Commands\n\n```bash\n# Encrypt a file\ngo run main.go -e file=\u003cfile to encrypt\u003e key=\u003ckeyfile\u003e\n\n# Decrypt a file\ngo run main.go -d file=\u003cfile to decrypt\u003e key=\u003ckeyfile\u003e\n```\n\n### Command Line Arguments\n\n- `-e`: Encrypt the specified file\n- `-d`: Decrypt the specified file\n- `file=\u003cpath\u003e`: Path to the input file\n- `key=\u003cpath\u003e`: Path to the key file\n\n### Key File Format\n\nThe key file can contain any content. The system will:\n\n1. Read the entire key file\n2. Generate a SHA-256 hash of the content\n3. Use the first 16 bytes of the hash as the TEA key\n\nExample of creating a key file:\n\n```bash\n# Create a key file with any content\necho \"MySecretKey12345\" \u003e mykey.txt\n\n# Or use a random key\nopenssl rand -base64 32 \u003e mykey.txt\n```\n\n### Output Files\n\n- **Encryption**: Overwrites the input file with encrypted content\n- **Decryption**: Overwrites the input file with decrypted content\n\n## Implementation Details\n\n### TEA Algorithm\n\nThe implementation includes all standard TEA operations:\n\n1. **Key Setup**: 4 uint32 values derived from 16-byte key\n2. **Block Processing**: 8-byte blocks with 32 rounds\n3. **Delta Constant**: Uses 0x9E3779B9 as the delta value\n4. **Padding**: Null byte padding for non-8-byte aligned data\n\n### Key Features\n\n- **Complete TEA Implementation**: Full encryption and decryption\n- **SHA-256 Key Hashing**: Consistent 128-bit key generation\n- **Automatic Padding**: Handles files of any size\n- **Error Handling**: Input validation and error reporting\n- **Overflow Protection**: Proper handling of large calculations\n\n### Security Notes\n\n- Uses TEA algorithm with 32 rounds\n- SHA-256 key hashing for consistent key size\n- Processes data in 8-byte blocks\n- Automatic padding management\n\n## Building and Running\n\n```bash\n# Build the application\ngo build -o file-encryptor\n\n# Run with arguments\n./file-encryptor -e file=document.txt key=secret.key\n```\n\n## Example Workflow\n\n```bash\n# 1. Create a test file\necho \"Hello, this is a secret message!\" \u003e secret.txt\n\n# 2. Create a key file\necho \"MySecretKey12345\" \u003e mykey.txt\n\n# 3. Encrypt the file\ngo run main.go -e file=secret.txt key=mykey.txt\n\n# 4. Verify encryption (file should be unreadable)\ncat secret.txt\n\n# 5. Decrypt the file\ngo run main.go -d file=secret.txt key=mykey.txt\n\n# 6. Verify decryption\ncat secret.txt\n```\n\n## Technical Implementation\n\nThe codebase is organized into several modules:\n\n- `tea/encrypt.go`: TEA encryption implementation\n- `tea/decrypt.go`: TEA decryption implementation\n- `cmd/args.go`: Command-line argument parsing\n- `cmd/io.go`: File I/O operations\n- `main.go`: Application entry point and workflow\n\nAll cryptographic operations are implemented from scratch, ensuring no external cryptographic dependencies beyond Go's standard library.\n\n## File Structure\n\n```\nfile-encryptor/\n├── main.go          # Main application entry point\n├── tea/\n│   ├── encrypt.go   # TEA encryption implementation\n│   └── decrypt.go   # TEA decryption implementation\n├── cmd/\n│   ├── args.go      # Command-line argument parsing\n│   └── reader.go    # File I/O operations\n├── go.mod           # Go module definition\n└── readme.md        # This file\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydv-ankit%2Ffile-encryptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fydv-ankit%2Ffile-encryptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fydv-ankit%2Ffile-encryptor/lists"}