{"id":50727154,"url":"https://github.com/fahimfba/safelicensing-pypi","last_synced_at":"2026-06-10T05:01:32.215Z","repository":{"id":362344090,"uuid":"1258553287","full_name":"FahimFBA/safelicensing-pypi","owner":"FahimFBA","description":"Safelicensing Pypi app","archived":false,"fork":false,"pushed_at":"2026-06-03T19:41:23.000Z","size":6395,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T21:03:51.631Z","etag":null,"topics":["encryption","encryption-algorithms","encryption-decryption","license","license-plate-detection","license-plate-recognition","pypi","pypi-package"],"latest_commit_sha":null,"homepage":"https://fahimfba.github.io/safelicensing-pypi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FahimFBA.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T17:31:36.000Z","updated_at":"2026-06-03T19:35:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/FahimFBA/safelicensing-pypi","commit_stats":null,"previous_names":["fahimfba/safelicensing-pypi"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/FahimFBA/safelicensing-pypi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahimFBA%2Fsafelicensing-pypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahimFBA%2Fsafelicensing-pypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahimFBA%2Fsafelicensing-pypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahimFBA%2Fsafelicensing-pypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FahimFBA","download_url":"https://codeload.github.com/FahimFBA/safelicensing-pypi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FahimFBA%2Fsafelicensing-pypi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34137570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":["encryption","encryption-algorithms","encryption-decryption","license","license-plate-detection","license-plate-recognition","pypi","pypi-package"],"created_at":"2026-06-10T05:01:30.496Z","updated_at":"2026-06-10T05:01:32.210Z","avatar_url":"https://github.com/FahimFBA.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SafeLicensing\n\n[![PyPI version](https://img.shields.io/pypi/v/safelicensing?color=0ea5e9\u0026label=PyPI)](https://pypi.org/project/safelicensing/)\n[![Python](https://img.shields.io/pypi/pyversions/safelicensing?color=0ea5e9)](https://pypi.org/project/safelicensing/)\n[![License](https://img.shields.io/pypi/l/safelicensing?color=0ea5e9)](LICENSE)\n[![Release](https://img.shields.io/github/actions/workflow/status/FahimFBA/safelicensing-pypi/release.yml?label=release\u0026color=0ea5e9)](https://github.com/FahimFBA/safelicensing-pypi/actions/workflows/release.yml)\n[![Docs](https://img.shields.io/badge/docs-online-0ea5e9)](https://fahimfba.github.io/safelicensing-pypi/)\n\n**License plate detection and chaotic-map encryption for images and videos.**\n\nDetect vehicle license plates with YOLOv8 and encrypt only the sensitive regions using a dual-pass chaotic XOR scheme, leaving the rest of the image or video completely intact.\n\nBuilt on the research published at IEEE ECCE 2024:\n\u003e *Vehicle Number Plate Detection and Encryption in Digital Images Using YOLOv8 and Chaotic-Based Encryption Scheme* - [View on IEEE Xplore](https://ieeexplore.ieee.org/abstract/document/10534375/)\n\n**Full documentation:** [fahimfba.github.io/safelicensing-pypi](https://fahimfba.github.io/safelicensing-pypi/)\n\n---\n\n## Features\n\n- **One-call API**: `protect_image()` and `protect_video()` handle detection and encryption end-to-end\n- **Bundled model**: 6 MB YOLOv8 weights ship with the package; no separate download needed\n- **Programmable low-level API**: exposes `logistic_map`, `generate_key`, `shuffle_pixels`, `encrypt_image` for research use\n- **Streamlit UI**: launch a full browser-based interface with a single command\n- **Video support**: frame-by-frame plate detection and encryption with audio preservation\n\n---\n\n## Installation\n\n### From PyPI\n\n```bash\npip install safelicensing\n```\n\n### From source\n\n```bash\ngit clone https://github.com/FahimFBA/safelicensing-pypi.git\ncd safelicensing-pypi\npip install -r requirements.txt\npip install -e .\n```\n\nPython 3.8+ required.\n\n---\n\n## Quick Start\n\n### CLI - Streamlit web app\n\n```bash\nsafelicensing\n```\n\nOpens a browser UI where you can upload images or videos, tune the encryption seed, and download protected output.\n\n### Protect an image\n\n```python\nimport safelicensing as sl\nfrom PIL import Image\n\nmodel = sl.load_model()                          # loads bundled best.pt\nimage = Image.open(\"car.jpg\")\n\nresult = sl.protect_image(image, seed=0.42, model=model)\n\nresult.original.show()                           # original image\nresult.detected.show()                           # plates highlighted in red\nresult.encrypted.save(\"car_protected.jpg\")       # plates encrypted\n\nprint(f\"Plates found : {len(result.bboxes)}\")\nprint(f\"Elapsed      : {result.elapsed:.2f}s\")\n```\n\n### Protect a video\n\n```python\nimport safelicensing as sl\n\nmodel = sl.load_model()\n\nresult = sl.protect_video(\n    \"dashcam.mp4\",\n    seed=0.42,\n    model=model,\n    output_path=\"dashcam_protected.mp4\",\n)\n\nprint(f\"Output  : {result.output_path}\")\nprint(f\"Frames  : {result.frame_count}\")\nprint(f\"FPS     : {result.fps:.2f}\")\nprint(f\"Elapsed : {result.elapsed:.2f}s\")\n```\n\n---\n\n## API Reference\n\nFull docs at [fahimfba.github.io/safelicensing-pypi](https://fahimfba.github.io/safelicensing-pypi/).\n\n### High-level\n\n#### `sl.protect_image(image, seed=0.5, model=None, model_path=None) -\u003e ProtectImageResult`\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `image` | `PIL.Image.Image` | Input image (any colour mode). |\n| `seed` | `float` | Encryption seed in `(0.0, 1.0)`. Default `0.5`. |\n| `model` | YOLO instance | Pre-loaded model. Loads bundled model when `None`. |\n| `model_path` | `str` | Path to custom `.pt` weights. Ignored when `model` is given. |\n\n**Returns** `ProtectImageResult`:\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `original` | `PIL.Image.Image` | Unmodified RGB input. |\n| `detected` | `PIL.Image.Image` | Input with red bounding boxes. |\n| `encrypted` | `PIL.Image.Image` | Plate regions encrypted. |\n| `bboxes` | `list[tuple]` | `(x1, y1, x2, y2)` per detected plate. |\n| `elapsed` | `float` | Processing time in seconds. |\n\n#### `sl.protect_video(video_path, seed=0.5, output_path=None, model=None, model_path=None, progress_callback=None) -\u003e ProtectVideoResult`\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `video_path` | `str` | Path to input video (mp4, avi, mov). |\n| `seed` | `float` | Encryption seed in `(0.0, 1.0)`. Default `0.5`. |\n| `output_path` | `str` | Output path. Defaults to `\u003cstem\u003e_encrypted.mp4`. |\n| `model` | YOLO instance | Pre-loaded model. Loads bundled model when `None`. |\n| `model_path` | `str` | Custom weights path. Ignored when `model` is given. |\n| `progress_callback` | `callable` | Receives a `float` in `[0.0, 1.0]` per frame. |\n\n**Returns** `ProtectVideoResult`:\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `output_path` | `str` | Absolute path to the encrypted video. |\n| `frame_count` | `int` | Total frames processed. |\n| `fps` | `float` | Output frame rate. |\n| `elapsed` | `float` | Processing time in seconds. |\n\n#### `sl.load_model(weights_path=None) -\u003e YOLO`\n\nLoad a YOLOv8 model. Uses the bundled `best.pt` when `weights_path` is `None`.\n\n### Low-level (research)\n\n```python\nfrom safelicensing.encryption import logistic_map, generate_key, shuffle_pixels, encrypt_image\nfrom safelicensing.detection  import load_model, detect_license_plates\nfrom safelicensing.video      import process_video, create_video_from_frames\n```\n\nSee the [full low-level API reference](https://fahimfba.github.io/safelicensing-pypi/docs/api/low-level).\n\n---\n\n## Encryption details\n\nThe scheme applies two passes per region:\n\n1. **XOR pass 1**: every pixel byte is XOR'd with a chaotic key generated by iterating the logistic map at `r = 3.9` from the given seed.\n2. **Pixel shuffle**: all pixels are randomly permuted using a seed-reproducible permutation.\n3. **XOR pass 2**: the shuffled bytes are XOR'd with a second chaotic key derived from a perturbed seed (`min(seed * 1.1, 0.9999)`).\n\nThe same seed always produces the same encrypted output, making the process deterministic and auditable.\n\n---\n\n## Development\n\n```bash\ngit clone https://github.com/FahimFBA/safelicensing-pypi.git\ncd safelicensing-pypi\npip install -r requirements-dev.txt\npip install -e .\n```\n\n```bash\npytest                      # unit tests\npytest -m integration       # integration tests (requires model + disk)\npytest --cov=safelicensing  # with coverage\n```\n\n---\n\n## Releasing a new version\n\nEdit `CHANGELOG.md` and add a new version section at the top:\n\n```markdown\n## [1.0.2] - 2026-06-10\n\n### Added\n- Your change here\n\n### Fixed\n- Bug fix here\n```\n\nCommit and push to `main`. The CI pipeline will automatically:\n\n1. Parse the new version from `CHANGELOG.md`\n2. Update `pyproject.toml` and `safelicensing/__init__.py`\n3. Build the distribution\n4. Publish to [PyPI](https://pypi.org/project/safelicensing/)\n5. Create a GitHub Release with changelog notes and `.whl` / `.tar.gz` attached\n\nNo manual steps needed beyond editing the changelog.\n\n---\n\n## Authors\n\n- [Md. Fahim Bin Amin](https://www.fahimbinamin.com)\n- [Israt Jahan Khan](https://www.isratjahankhan.com)\n\n---\n\n## Citation\n\n```bibtex\n@inproceedings{amin2024safelicensing,\n  title     = {Vehicle Number Plate Detection and Encryption in Digital Images\n               Using YOLOv8 and Chaotic-Based Encryption Scheme},\n  author    = {Amin, Md. Fahim Bin and Khan, Israt Jahan},\n  booktitle = {2024 International Conference on Electrical, Computer and\n               Communication Engineering (ECCE)},\n  year      = {2024},\n  publisher = {IEEE},\n  url       = {https://ieeexplore.ieee.org/abstract/document/10534375/}\n}\n```\n\n---\n\n## License\n\nApache License 2.0 - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahimfba%2Fsafelicensing-pypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffahimfba%2Fsafelicensing-pypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffahimfba%2Fsafelicensing-pypi/lists"}