{"id":13659791,"url":"https://github.com/diglol/encoding","last_synced_at":"2026-01-11T17:43:29.520Z","repository":{"id":40733608,"uuid":"398510655","full_name":"diglol/encoding","owner":"diglol","description":"Diglol Encoding provides Hex/Base16, Base32, Base45, Base64 encodings for Kotlin Multiplatform.","archived":false,"fork":false,"pushed_at":"2024-06-10T20:46:38.000Z","size":834,"stargazers_count":10,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2024-08-02T05:11:07.230Z","etag":null,"topics":["base16","base32","base64","encoding","hex","kotlin","multiplatform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/diglol.png","metadata":{"files":{"readme":"README-zh.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}},"created_at":"2021-08-21T08:52:17.000Z","updated_at":"2024-07-22T17:54:50.000Z","dependencies_parsed_at":"2023-01-31T07:15:18.140Z","dependency_job_id":"aa834a13-edf0-43a1-bce9-1721d54db17e","html_url":"https://github.com/diglol/encoding","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diglol%2Fencoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diglol%2Fencoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diglol%2Fencoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diglol%2Fencoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diglol","download_url":"https://codeload.github.com/diglol/encoding/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223958139,"owners_count":17231743,"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":["base16","base32","base64","encoding","hex","kotlin","multiplatform"],"created_at":"2024-08-02T05:01:12.358Z","updated_at":"2026-01-11T17:43:29.480Z","avatar_url":"https://github.com/diglol.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":["🔧 Utils"],"readme":"# Diglol Encoding\n\nDiglol Encoding 为 Kotlin Multiplatform 提供了 Hex/Base16、Base32、Base45、Base64 编码。\n\n当前支持的编码:\n\n- Hex (Base16)\n- Base32 [Std, Hex]\n- Base45\n- Base64 [Std, Url]\n\n### 发布\n\n我们的 [change log](CHANGELOG.md) 有发布历史。\n\n```gradle\nimplementation(\"com.diglol.encoding:encoding:0.3.0\")\n```\n\n### 使用\n\n##### [Hex][rfc4648]\n\n```kotlin\nval data = \"foobar\".toByteArray()\n\nval hex = data.encodeHex()\nprintln(hex)\n// 输出：666F6F626172\nassert(data.contentEquals(hex.decodeHex()))\n```\n\n##### [Base32][rfc4648]\n\n```kotlin\nval data = \"foobar\".toByteArray()\nval base32String = data.encodeBase32ToString()\nprintln(base32String)\n// 输出：MZXW6YTBOI======\nassert(data.contentEquals(base32String.decodeBase32ToBytes()))\n\nval base32HexString = data.encodeBase32HexToString()\nprintln(base32HexString)\n// 输出：CPNMUOJ1E8======\nassert(data.contentEquals(base32HexString.decodeBase32HexToBytes()))\n```\n\n##### [Base45][rfc9285]\n\n```kotlin\nval data = \"base-45\".encodeToByteArray()\nval base45String = data.encodeBase45ToString()\nprintln(base45String)\n// 输出：UJCLQE7W581\nassert(data.contentEquals(base45String.decodeBase45ToBytes()))\n```\n\n##### [Base64][rfc4648]\n\n```kotlin\nval base64String = data.encodeBase64ToString()\nprintln(base64String)\n// 输出：Zm9vYmFy\nassert(data.contentEquals(base64String.decodeBase64ToBytes()))\n\nval base64UrlString = data.encodeBase64UrlToString()\nprintln(base64UrlString)\n// 输出：Zm9vYmFy\nassert(data.contentEquals(base64UrlString.decodeBase64UrlToBytes()))\n```\n\n### License\n\n    Copyright 2022 Diglol\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n[rfc4648]: https://datatracker.ietf.org/doc/html/rfc4648\n[rfc9285]: https://datatracker.ietf.org/doc/html/rfc9285\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiglol%2Fencoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiglol%2Fencoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiglol%2Fencoding/lists"}