{"id":15520965,"url":"https://github.com/sloev/hashdate","last_synced_at":"2025-03-28T20:14:54.358Z","repository":{"id":62568928,"uuid":"263753952","full_name":"sloev/hashdate","owner":"sloev","description":"Turns Python datetimes (or iso dates with cli) into hashes.","archived":false,"fork":false,"pushed_at":"2020-05-13T22:21:30.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T05:17:30.075Z","etag":null,"topics":["datetime","hash","python3"],"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/sloev.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}},"created_at":"2020-05-13T22:09:08.000Z","updated_at":"2020-05-14T06:32:40.000Z","dependencies_parsed_at":"2022-11-03T17:15:16.738Z","dependency_job_id":null,"html_url":"https://github.com/sloev/hashdate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fhashdate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fhashdate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fhashdate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fhashdate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloev","download_url":"https://codeload.github.com/sloev/hashdate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246093180,"owners_count":20722402,"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":["datetime","hash","python3"],"created_at":"2024-10-02T10:31:02.423Z","updated_at":"2025-03-28T20:14:54.338Z","avatar_url":"https://github.com/sloev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![hashdate](https://github.com/sloev/hashdate/raw/master/assets/logo.png)\n\n# HashDate \n\n[![Latest Version](https://img.shields.io/pypi/v/hashdate.svg)](https://pypi.python.org/pypi/hashdate) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTurns Python datetimes (or iso dates with `cli`) into hashes.\n\nThe hashes support shortening to reduce precision, so a prefix of a hash will be the same datetime rounded to the given hashlength.\n\n## Cli usage\n\nCheck out the demo:\n```bash\n$ hashdate demo\n``` \n\nIts full of colors:\n\n[![asciicast](https://asciinema.org/a/kKaOD68BJXa11WA1ghW7vjqii.svg)](https://asciinema.org/a/kKaOD68BJXa11WA1ghW7vjqii)\n\nTurn your iso date into a hash:\n\n```bash\n$ hashdate date2hash 2020-05-13T22:30:47.136450\nhash: UCABCBDCCDAEHBDGEFA\n```\n\nThen if you only take the first 11 chars you get a datetime with less precision:\n\n```bash\n$ hashdate hash2date UCABCBDCCDA\ndatetime: 2020-05-13T22:30:00\n```\n\nyou can also secify to use emojis for charset if you want to:\n\n```bash\n$ hashdate date2hash 2020-05-13T22:30:47.136450 -c emoji\nhash: 🌹🐲🌼🥕🐲🥕🌲🐲🐲🌲🌼🍇🐐🥕🌲🌴🍇🐂🌼\n```\n\nand back again:\n\n```bash\n$ hash2date 🌹🐲🌼🥕🐲🥕🌲🐲🐲🌲🌼🍇🐐🥕🌲🌴🍇🐂🌼 -c emoji\ndatetime: 2020-05-13T22:30:47.136450\n```\n\n## Module usage\n\n```python\nimport datetime\nfrom hashdate import datetime_to_hash, hash_to_datetime\n\nnow = datetime.datetime.now()\nhash = datetime_to_hash(now)\ndt = hash_to_datetime(hash)\nassert now == dt\n```\n\n### Advanced\n\nUse emojis:\n\n```python\nimport datetime\nfrom hashdate import datetime_to_hash, hash_to_datetime\n\nnow = datetime.datetime.now()\nhash = datetime_to_hash(now, charset='emoji')\ndt = hash_to_datetime(hash, charset='emoji')\nassert now == dt\n```\n\nRegister more charsets:\n\n```python\nimport datetime\nfrom hashdate import register_charset, datetime_to_hash, hash_to_datetime\n\ncharset = \"🌼🥕🐲🌲🍇🐂🌴🐐🍉🌺🍊🐽🍆🦎🍟🌱🐫🐍🐃🍍🌹🍕☘🌿🥓🐪🌷🏵🔥🐷🌳🌶🥒🐊🐗🐏🌵🌻🌽🐢🍋🍈💮🎃🌊🥔🌰🍀🍃💧💐🍂🐮🌸🐄🍄🍁🍞🥜🐑🥀🌭🐸🐖\"\n\nregister_charset('my_emojis', charset)\n\nnow = datetime.datetime.now()\nhash = datetime_to_hash(now, charset='my_emojis')\ndt = hash_to_datetime(hash, charset='my_emojis')\nassert now == dt\n```\n\n\n## Structure of a hashdate\n\n```\ncentenial: [...19,20,21...]\n|    quarter start month: [0,3,6,9]\n|    |   day in tens: [0:3]\n|    |   |   hour in tens: [0:5]\n|    |   |   |   minute in tens: [0:5]\n|    |   |   |   |   second in tens: [0:5]\n|    |   |   |   |   |   microsecond digits:[0:999999]\n|    |   |   |   |   |   |\nU CA B C B D C B A F C E BCDAAB  \n  |    |   |   |   |   | \n  |    |   |   |   |   second: [0:9]\n  |    |   |   |   minute: [0:9]\n  |    |   |   hour: [0:9]\n  |    |   day: [0:9]\n  |    month in quarter: [0,1,2]\n  year: [0:99]\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fhashdate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloev%2Fhashdate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fhashdate/lists"}