{"id":17797084,"url":"https://github.com/anselmoo/copy2hash","last_synced_at":"2026-04-27T17:33:58.530Z","repository":{"id":49143402,"uuid":"265005015","full_name":"Anselmoo/copy2hash","owner":"Anselmoo","description":"Copy or rename any file(s) to a hash-secured filename via terminal","archived":false,"fork":false,"pushed_at":"2021-06-26T19:44:06.000Z","size":83,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-27T10:07:57.658Z","etag":null,"topics":["data-science","data-warehouse","database","hash","indexation","sha","sha256"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Anselmoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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":"2020-05-18T16:59:32.000Z","updated_at":"2021-08-14T17:56:11.000Z","dependencies_parsed_at":"2022-08-25T16:20:20.801Z","dependency_job_id":null,"html_url":"https://github.com/Anselmoo/copy2hash","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Anselmoo/copy2hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anselmoo%2Fcopy2hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anselmoo%2Fcopy2hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anselmoo%2Fcopy2hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anselmoo%2Fcopy2hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anselmoo","download_url":"https://codeload.github.com/Anselmoo/copy2hash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anselmoo%2Fcopy2hash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262235783,"owners_count":23279567,"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":["data-science","data-warehouse","database","hash","indexation","sha","sha256"],"created_at":"2024-10-27T11:50:47.590Z","updated_at":"2026-04-27T17:33:58.489Z","avatar_url":"https://github.com/Anselmoo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Travis (.com)](https://img.shields.io/travis/com/Anselmoo/copy2hash?logo=travis)](https://travis-ci.com/github/Anselmoo/copy2hash)\n[![Codecov](https://img.shields.io/codecov/c/github/Anselmoo/copy2hash?logo=Codecov)](https://codecov.io/gh/Anselmoo/copy2hash)\n[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/Anselmoo/copy2hash/master?logo=codefactor)](https://www.codefactor.io/repository/github/anselmoo/copy2hash)\n[![Code Style: Black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/ambv/black)\n[![GitHub](https://img.shields.io/github/license/Anselmoo/copy2hash?logo=GitHub)](https://github.com/Anselmoo/copy2hash/blob/master/LICENSE)\n\n[![Build Status](https://dev.azure.com/anselmhahn/anselmhahn/_apis/build/status/Anselmoo.copy2hash?branchName=master)](https://dev.azure.com/anselmhahn/anselmhahn/_build/latest?definitionId=5\u0026branchName=master)\n[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/anselmhahn/anselmhahn/5?logo=Azure-Devops\u0026logoColor=blue)](https://dev.azure.com/anselmhahn/anselmhahn/_build/latest?definitionId=5\u0026branchName=master)\n\n[![PyPI](https://img.shields.io/pypi/v/copy2hash?logo=pypi\u0026logoColor=yellow)](https://pypi.org/project/copy2hash/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/copy2hash?logo=python\u0026logoColor=yellow)](https://pypi.org/project/copy2hash/)\n# copy2hash\n\n## Copy or rename any file(s) to a _hash-secured_ filename via terminal\n\n---\n\n`copy2hash` copies or renames file(s) with regular titles to file(s) with a _hash-secured_ title by using the terminal or in `python`-framework. Having unique filenames is essential for the correct indexing of databases, especially if the data come from different pipelines. Also, it is important if the filename or/and directory contains _meta_-information, which extends the length of the valid file lengths.\n\nHaving _regular_-filename pairs such as `example.input` \u0026rlarr; `example.output` can brings very fast confusion and makes analysis of data very confusing. The secured hash algorithms (**SHA**) [1-5] in `copy2hash` provides a safe way to generate distinguishable filenames like:\n\n`example.input` \u0026rlarr; `example.output` \u0026xrarr; `7e2229daab26b247b877565505b6aaf131014f2cb64e4c4ca796fbe0dc2fadc4.input` \u0026rlarr; `4bd077ed771af9ad97e3f2dc45583a14af014ebafb73a846f2436a168ae3eafa.output`\n\nThe following **SHA** algorithms [1-5] are available:\n\n1. `sha1`\n2. `sha224`\n3. `sha256`\n4. `sha384`\n5. `sha512`\n6. `blake2b`\n7. `blake2s`\n8. `md5`\n9. `sha3_224`\n10. `sha3_256`\n11. `sha3_384`\n12. `sha3_512`\n13. `shake_128` with fixed `32` character length\n14. `shake_256` with fixed `32` character length\n\nand the copied or moved processed will be automatically logged as:\n\n1.  `*.csv`-file:\n2.  `*.json`-file\n3.  `*.pkl`-file\n4.  `*.txt`-file\n5.  `*.yaml`-file\n6.  `*.xml`-file\n\n## Installation\n\n---\n\n`pip install copy2hash`\n\nor\n\n`pip install https://github.com/Anselmoo/copy2hash.git`\n\nor\n\n```bash\npip install -r requirements.txt\npython setup.py install\n```\n\n## Requirments\n\n---\n\n1.  Python3 \u003e= 3.6\n2.  [dict2xml\u003e=1.7.0](https://github.com/lucasicf/dict2xml)\n3.  [PyYAML\u003e=5.3.1](https://github.com/yaml/pyyaml)\n\n## Usage\n\n---\n\n```bash\n╰─ copy2hash * -h\nusage: copy2hash [-h] [-r [REPORT [REPORT ...]]] [-rn REPORT_NAME]\n                 [-s [SHA [SHA ...]]] [-dir DIRECTORY] [-mv] [-fxt] [-sxt]\n                 [-nfxt] [-ver] [-v]\n                 [infile [infile ...]]\n\ncopy or rename any file(s) to a hash-secured filename via terminal\n\npositional arguments:\n  infile                file(s) to copy or to rename with regular filename to\n                        secured hash filename\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -r [REPORT [REPORT ...]], --report [REPORT [REPORT ...]]\n                        define one or a series of file format(s) for the\n                        rename-report(s) to retrace the copying or rename of\n                        the file(s). The availabel file formats are:'csv',\n                        'json', 'pkl', 'txt', 'yaml', 'xml', or own file-\n                        extension as ASCII; default is 'json'\n  -rn REPORT_NAME, --report_name REPORT_NAME\n                        define the report name for the copied or move file(s);\n                        default is 'copy_report'\n  -s [SHA [SHA ...]], --sha [SHA [SHA ...]]\n                        define one or a series of secure hash algorithms (sha)\n                        for copying or rename of the file(s). The availabel\n                        secure hash algorithms (sha) are: 'sha1', 'sha224',\n                        'sha256', 'sha384', 'sha512', 'blake2b', 'blake2s',\n                        'md5', 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',\n                        'shake_128', 'shake_256'; default 'sha256'. The\n                        'shake_128' and 'shake_256' are defined for 32\n                        character length.\n  -dir DIRECTORY, --directory DIRECTORY\n                        replace the standard directory ('./') by a specific\n                        directory ('./path'). If the specific directory not\n                        exist, the directory will be created. This can\n                        required sudo rights.\n  -mv, --move           moving the file(s) instead of copying the files with\n                        regular filename to secure hash filename\n  -fxt, --file_extension\n                        replaced the given file-extension by the abbreviations\n                        of the used secure hash algorithms (sha)\n  -sxt, --file_suffix   removed the given file-extension and add a suffix in\n                        front of the file based on the abbreviations of the\n                        used secure hash algorithms (sha). It is seperated by\n                        colon like 'sha256-e3b0c44298fc1c149afbf4c8996fb92427a\n                        e41e4649b934ca495991b7852b855'\n  -nfxt, --no_file_extension\n                        removed the any file-extension and just copy or move\n                        the file(s) as sha renamed file(s)\n  -ver, --verbose       enable the verbose mode\n  -v, --version         displays the current version of cop2hash\n```\n\n## Other Examples\n\n---\n\nFor keeping the regular file-extension, use:\n\n`copy2hash * -r json csv yaml`\n\n| _regular_-filename |        | _sha256_-filename                                                      |\n| ------------------ | ------ | ---------------------------------------------------------------------- |\n| `example.out`      | \u0026rarr; | `c8e1f67ad67b8f456afe76b5eb5d6dd0a919b1537cd67b9419f86158e4d9c1b4.out` |\n| `example.t`        | \u0026rarr; | `97c7bc3705df72f76cf3d3d55228751bc6895a488fb004b112914d4a05447c16.t`   |\n| `example.tx`       | \u0026rarr; | `11297eae82d7866c4dd42e79b8082a5256fa3d54e7e1bf60ab87747e9b664303.tx`  |\n| `example.txt`      | \u0026rarr; | `e7cb632359a2be17c1008b50f9ec85691cd5d66834d5fe8f63ef65ceb06682ee.txt` |\n| `example_1.txt`    | \u0026rarr; | `85a6fae2fca1342a85222088ff0342cbea8222e4140aba96690691c9d58e5786.txt` |\n| `example_2.txt`    | \u0026rarr; | `0329cb55ddfab933d9753686ddb193148003611df672a4a41aad014ead4767f9.txt` |\n| `example_l.txt`    | \u0026rarr; | `eb4d990362cbf5cccd0b49374b71ca3f799c7262352c9fda7ba875ba034f7168.txt` |\n\nRemoving the regular file-extension and adding the SHA-key in front, use:\n\n`copy2hash * -r json csv yaml -sxt`\n\n| _regular_-filename |        | _sha256_-filename                                                         |\n| ------------------ | ------ | ------------------------------------------------------------------------- |\n| `example.out`      | \u0026rarr; | `sha256-c8e1f67ad67b8f456afe76b5eb5d6dd0a919b1537cd67b9419f86158e4d9c1b4` |\n| `example.t`        | \u0026rarr; | `sha256-97c7bc3705df72f76cf3d3d55228751bc6895a488fb004b112914d4a05447c16` |\n| `example.tx`       | \u0026rarr; | `sha256-11297eae82d7866c4dd42e79b8082a5256fa3d54e7e1bf60ab87747e9b664303` |\n| `example.txt`      | \u0026rarr; | `sha256-e7cb632359a2be17c1008b50f9ec85691cd5d66834d5fe8f63ef65ceb06682ee` |\n| `example_1.txt`    | \u0026rarr; | `sha256-85a6fae2fca1342a85222088ff0342cbea8222e4140aba96690691c9d58e5786` |\n| `example_2.txt`    | \u0026rarr; | `sha256-0329cb55ddfab933d9753686ddb193148003611df672a4a41aad014ead4767f9` |\n| `example_l.txt`    | \u0026rarr; | `sha256-eb4d990362cbf5cccd0b49374b71ca3f799c7262352c9fda7ba875ba034f7168` |\n\n### More Examples\n\nGenerate a report in the `json`- and `yaml`-format:\n\n`copy2hash example.input example.output -r json yaml`\n\n```json\n{\n  \"index\": [0, 1],\n  \"filename\": [\"example.input\", \"example.output\"],\n  \"mode\": [\"copy\", \"copy\"],\n  \"home_dir\": [\".\", \".\"],\n  \"copy_dir\": [\".\", \".\"],\n  \"sha256\": [\n    \"7e2229daab26b247b877565505b6aaf131014f2cb64e4c4ca796fbe0dc2fadc4.input\",\n    \"4bd077ed771af9ad97e3f2dc45583a14af014ebafb73a846f2436a168ae3eafa.output\"\n  ]\n}\n```\n\n```yaml\ncopy_dir:\n  - .\n  - .\nfilename:\n  - example.input\n  - example.output\nhome_dir:\n  - .\n  - .\nindex:\n  - 0\n  - 1\nmode:\n  - copy\n  - copy\nsha256:\n  - 7e2229daab26b247b877565505b6aaf131014f2cb64e4c4ca796fbe0dc2fadc4.input\n  - 4bd077ed771af9ad97e3f2dc45583a14af014ebafb73a846f2436a168ae3eafa.output\n```\n\n## Using as Built-in\n\n---\n\n```python\nfrom copy2hash import copy2hash\nfrom pathlib import Path\n\nargs = {\n            \"infile\": list(Path(\"test\").glob(\"example1.txt\")),\n            \"report\": [\"json\"],\n            \"report_name\": \"copy_report\",\n            \"sha\": [\"sha256\"],\n            \"directory\": None,\n            \"move\": None,\n            \"file_extension\": False,\n            \"file_suffix\": False,\n            \"no_file_extension\": False,\n            \"verbose\": True,\n            \"version\": False,\n        }\n\ncopy2hash.command_line_runner(opt=args)\n```\n\n## Author\n\n---\n\n- [Anselm Hahn](https://github.com/Anselmoo)\n\n## Contributions\n\n---\n\nI'm happy to accept how to improve batchplot; please forward your [issues](https://github.com/Anselmoo/copy2hash/issues) or [pull requests](https://github.com/Anselmoo/copy2hash/pulls).\n\nKeep in mind that [pull requests](https://github.com/Anselmoo/copy2hash/pulls) have to pass TravisCI in combination with [flake8](https://github.com/PyCQA/flake8), [black](https://github.com/psf/black), and [pydocstyle](https://github.com/PyCQA/pydocstyle).\n\n## License\n\n---\n\nThe source code of `copy2hash` is licensed under the [MIT license](https://github.com/Anselmoo/copy2hash/blob/master/LICENSE).\n\n## References\n\n---\n\n1.  https://docs.python.org/3/library/hashlib.html\n2.  https://tools.ietf.org/html/rfc1321.html\n3.  https://en.wikipedia.org/wiki/NIST_hash_function_competition\n4.  https://131002.net/blake/\n5.  https://docs.python.org/3/library/hashlib.html#hashlib.blake2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanselmoo%2Fcopy2hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanselmoo%2Fcopy2hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanselmoo%2Fcopy2hash/lists"}