{"id":34976233,"url":"https://github.com/martian56/rail_fence","last_synced_at":"2025-12-27T00:11:34.213Z","repository":{"id":292640260,"uuid":"981492828","full_name":"martian56/rail_fence","owner":"martian56","description":"Rust implementation of the **RailFence Cipher**","archived":false,"fork":false,"pushed_at":"2025-05-11T08:54:48.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T14:43:50.601Z","etag":null,"topics":["cryptography","encryption-decryption","rail-fence","rail-fence-cipher"],"latest_commit_sha":null,"homepage":"https://fuad1234.pythonanywhere.com","language":"Rust","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/martian56.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-05-11T08:29:18.000Z","updated_at":"2025-05-13T07:47:08.000Z","dependencies_parsed_at":"2025-05-11T09:33:01.218Z","dependency_job_id":"bfd24a37-e4f4-4310-abaf-db895e248316","html_url":"https://github.com/martian56/rail_fence","commit_stats":null,"previous_names":["martian58/rail_fence","martian56/rail_fence"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/martian56/rail_fence","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martian56%2Frail_fence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martian56%2Frail_fence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martian56%2Frail_fence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martian56%2Frail_fence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martian56","download_url":"https://codeload.github.com/martian56/rail_fence/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martian56%2Frail_fence/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28065846,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cryptography","encryption-decryption","rail-fence","rail-fence-cipher"],"created_at":"2025-12-27T00:11:33.366Z","updated_at":"2025-12-27T00:11:34.207Z","avatar_url":"https://github.com/martian56.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rail Fence Cipher Implementation\n\nThis project implements the Rail Fence Cipher encryption and decryption in Rust. It demonstrates the correctness of the implementation through unit tests and provides a command-line interface for encrypting and decrypting text.\n\n## Features\n\n- **Encryption**: Convert plaintext to ciphertext using the zigzag Rail Fence pattern.\n- **Decryption**: Reconstruct plaintext from ciphertext using the Rail Fence pattern.\n- **Command-line Interface**: Specify options like depth of the fence, input text, and whether to encrypt or decrypt.\n- **Unit Tests**: Validate the correctness of the implementation with `cargo test`.\n\n---\n\n## Prerequisites\n\nTo build and run this project, make sure you have the following installed:\n\n- [Rust and Cargo](https://www.rust-lang.org/tools/install)\n\n---\n\n## How to Compile the Project\n\nTo compile the project, navigate to the project directory and run:\n\n```bash\ncargo build\n```\n\nThis will create the compiled binary in the `target/debug` directory.\n\n---\n\n## How to Run the Program\n\n### Installation\n\n```bash\ngit clone https://github.com/martian58/rail_fence.git\ncd rail_fence\ncargo run -- --help\n```\n\nYou can use the `cargo run` command to execute the program. The program requires several arguments:\n\n### Basic Command Syntax\n\n```bash\ncargo run -- [OPTIONS]\n```\nOr\n```bash\n./target/debug/rail_fence [OPTIONS]\n```\n\n### Get help \n```bash\ncargo run -- --help\n```\nOr\n```bash\n./target/debug/rail_fence --help\n```\n\n### Example Commands\n\n1. **Encrypt a Message**:\n\n   ```bash\n   cargo run -- -d 3 -i \"HELLO\"\n   ```\n\n   Output:\n   ```\n   Encrypted Text: HOELL\n   ```\n\n2. **Decrypt a Message**:\n\n   ```bash\n   cargo run -- -d 3 -i \"HOELL\" --decrypt\n   ```\n\n   Output:\n   ```\n   Decrypted Text: HELLO\n   ```\n\n### Command-Line Options\n\n| Option        | Description                                                                 |\n|---------------|-----------------------------------------------------------------------------|\n| `-d, --depth` | Depth of the Rail Fence cipher (number of rails). Required.                |\n| `-i, --input` | The text to encrypt or decrypt. Required.                                  |\n| `-x, --decrypt` | Decrypt the input text instead of encrypting it. Optional (default is encryption). |\n\n---\n\n## How to Run Unit Tests\n\nTo validate the correctness of the implementation, run the unit tests using:\n\n```bash\ncargo test\n```\n\n### Test Output\n\n```\nrunning 4 tests\ntest tests::test_encrypt ... ok\ntest tests::test_decrypt ... ok\ntest tests::test_encrypt_with_depth_4 ... ok\ntest tests::test_decrypt_with_depth_4 ... ok\n\ntest result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n```\n\n---\n\n## How to Clean the Project\n\nTo remove build artifacts and clean the project directory, run:\n\n```bash\ncargo clean\n```\n\n---\n\n## Project Structure\n\n- **`src/main.rs`**: Contains the implementation of the Rail Fence Cipher and the command-line interface.\n- **`Cargo.toml`**: Manages dependencies and project metadata.\n- **`README.md`**: Documentation for the project (this file).\n\n---\n\n## Example Usage\n\n1. **Encrypt a Longer Message**:\n\n   ```bash\n   cargo run -- -d 4 -i \"RAILFENCEISTHEBEST\"\n   ```\n\n   Output:\n   ```\n   Encrypted Text: RNHAECTETIFESBSLIE\n   ```\n\n2. **Decrypt the Same Message**:\n\n   ```bash\n   cargo run -- -d 4 -i \"RNHAECTETIFESBSLIE\" --decrypt\n   ```\n\n   Output:\n   ```\n   Decrypted Text: RAILFENCEISTHEBEST\n   ```\n\n---\n\n## Additional Notes\n\n- Ensure the depth of the Rail Fence cipher (`--depth`) is at least 2.\n- The input text can contain uppercase or lowercase characters, but the program will treat all characters as uppercase.\n- Non-alphabetic characters are ignored during encryption/decryption.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartian56%2Frail_fence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartian56%2Frail_fence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartian56%2Frail_fence/lists"}