{"id":19430201,"url":"https://github.com/etherdream/base36_914","last_synced_at":"2026-03-06T01:32:47.161Z","repository":{"id":255814362,"uuid":"853641315","full_name":"EtherDream/base36_914","owner":"EtherDream","description":"A fast and space-efficient Base36 encoding for large data","archived":false,"fork":false,"pushed_at":"2024-09-13T06:22:22.000Z","size":18,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T18:50:19.004Z","etag":null,"topics":["base36","encoding"],"latest_commit_sha":null,"homepage":"https://etherdream.github.io/base36_914","language":"C","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/EtherDream.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":"2024-09-07T05:37:20.000Z","updated_at":"2024-09-24T06:09:44.000Z","dependencies_parsed_at":"2024-09-13T14:10:30.869Z","dependency_job_id":null,"html_url":"https://github.com/EtherDream/base36_914","commit_stats":null,"previous_names":["etherdream/base36_914"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EtherDream/base36_914","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtherDream%2Fbase36_914","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtherDream%2Fbase36_914/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtherDream%2Fbase36_914/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtherDream%2Fbase36_914/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EtherDream","download_url":"https://codeload.github.com/EtherDream/base36_914/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EtherDream%2Fbase36_914/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30157843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"ssl_error","status_checked_at":"2026-03-05T22:39:24.771Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["base36","encoding"],"created_at":"2024-11-10T14:23:56.031Z","updated_at":"2026-03-06T01:32:47.121Z","avatar_url":"https://github.com/EtherDream.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Base36_914\n\nA fast and space-efficient Base36 encoding for large data.\n\n## About\n\n`Base36_914` encodes every `9` bytes as a block into `14` chars, with a max space efficiency of 99.5% of the theoretical limit.\n\nIf the remaining data is less than 9 bytes, the output will be padded to 14 chars. So this algorithm is suitable for longer inputs, or input length close to a multiple of 9.\n\n\n## Encode API\n\n### Full Block\n\n```c\nvoid base36_encode_block(u8 plain[9], u8 code[14], u8 encode_table[36])\n```\n\nRead 9 bytes from `plain` and write 14 bytes to `code`.\n\nThe built-in `BASE36_ENCODE_TABLE_DEFAULT` can be used for `encode_table`.（0-9 a-z）\n\n### Last Block\n\n```c\nvoid base36_encode_last_block(u8 plain[], int len, u8 code[14], encode_table[36])\n```\n\nRead `len` (0 \u003c len \u003c 9) bytes from `plain` and write 14 bytes to `code`.\n\n### All-in-One\n\n```c\nvoid base36_encode(u8 plain[], int len, u8 code[], encode_table)\n```\n\nRead `len` bytes from `plain` and write `ceil(len / 9) * 14` bytes to `code`.\n\n## Decode API\n\n### Full Block\n\n```c\nvoid base36_decode_block(u8 code[14], u8 plain[9], u8 decode_talbe[256])\n```\n\nRead 14 bytes from `code` and write 9 bytes to `plain`.\n\nThe built-in `BASE36_DECODE_TABLE_DEFAULT` can be used for `decode_talbe`.\n\n### Last Block\n\n```c\nint base36_decode_last_block(u8 code[14], u8 plain[], decode_talbe[256])\n```\n\nRead 14 bytes from `code` and write `len` bytes to `plain`.\n\n`len` is the return value. (0 \u003c len \u003c= 9)\n\n### All-in-One\n\n```c\nint base36_decode(u8 code[], int len, u8 plain[], decode_table)\n```\n\nRead `len` (must be a multiple of 14) bytes from `code` and write `len / 14 * 9` bytes to `plain`, return `len / 14 * 9`.\n\nThis function calls `base36_decode_last_block` only once.\n\n### Stream Mode\n\n```c\nint base36_decode_stream(u8 code[], int len, u8 plain[], decode_table)\n```\n\nIf `base36_encode` is called multiple times during encoding, the 14-char-padding(s) may be located in the middle of the codes. In this case, this function must be used for decoding.\n\nThis function always uses `base36_decode_last_block`, and returns the length of the decoded data.\n\n### Check\n\nNone of the above decoding functions check the input code, it needs to be checked by the caller.\n\nEven if the input code is out of the code table, the decoding functions can still work,  just with wrong result. If the decoded data has an integrity check, the input check can be ignored.\n\n\n## Demo1\n\n[demo-wasm](demo-wasm)\n\nOnline: https://etherdream.com/base36/\n\n\n## Demo2\n\n[demo-pipe](demo-pipe)\n\nTest:\n\n```bash\n./base36 \u003c\u003c\u003c \"Hello World 12345\"\n```\n\nPrint `gatk40t14s0idcgzbz9l6nvgmq31`.\n\nEncode:\n\n```bash\n./base36 \u003c file \u003e file36.txt\n```\n\nDecode:\n\n```bash\n./base36 -d \u003c file36.txt \u003e file-re\n```\n\n## TODO\n\nSIMD support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetherdream%2Fbase36_914","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetherdream%2Fbase36_914","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetherdream%2Fbase36_914/lists"}