{"id":28624175,"url":"https://github.com/zypeh/go-leb128","last_synced_at":"2025-06-12T07:11:38.574Z","repository":{"id":57596448,"uuid":"258417406","full_name":"zypeh/go-leb128","owner":"zypeh","description":"Little Endian Base 128, a variable-length code compression for arbitrarily large integer in a small number of bytes.","archived":false,"fork":false,"pushed_at":"2020-09-02T03:53:51.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T15:51:13.695Z","etag":null,"topics":["compression","encoder-decoder","leb128"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/zypeh.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-04-24T05:44:17.000Z","updated_at":"2024-04-29T21:57:58.000Z","dependencies_parsed_at":"2022-08-23T17:21:07.838Z","dependency_job_id":null,"html_url":"https://github.com/zypeh/go-leb128","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zypeh/go-leb128","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zypeh%2Fgo-leb128","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zypeh%2Fgo-leb128/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zypeh%2Fgo-leb128/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zypeh%2Fgo-leb128/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zypeh","download_url":"https://codeload.github.com/zypeh/go-leb128/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zypeh%2Fgo-leb128/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259418294,"owners_count":22854188,"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":["compression","encoder-decoder","leb128"],"created_at":"2025-06-12T07:11:29.690Z","updated_at":"2025-06-12T07:11:38.520Z","avatar_url":"https://github.com/zypeh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-leb128\n\u003e Little Endian Base 128, a variable-length code compression for arbitrarily large integer in a small number of bytes.\n\n# Usage \nThe bytes payload is typed in this library. So instead of using `[]byte` we are using\n\n* `SLeb128` for Signed LEB128 encoding\n* `ULeb128` for Unsigned LEB128 encoding\n\nSo for unsigned LEB128 encoding it should be written in\n\n```go\nsleb624485 := ULeb128{[]byte{0xE5, 0x8E, 0x26}}\n```\n\nAnd it cannot be consumed by signed LEB128 decoder (typed)\n\n```go\nDecodeSLeb128(sleb624485) // this will not compile\nDecodeULeb128(sleb624485) // compiles !\n```\n\n### Encoding\n\n**EncodeFromUint64(uint64) ULeb128**\n\nEncode `uint64` typed integer into `ULeb128`\n\n**EncodeFromInt64(int64) SLeb128**\n\nEncode `int64` typed integer into `SLeb128`\n\n\n### Decoding\n\n**DecodeULeb128(ULeb128) (uint64, error)**\n\nDecode `ULeb128` to uint64 with error flag\n\n**DecodeSLeb128(SLeb128) (int64, error)**\n\nDecode `SLeb128` to int64 with error flag\n\n\u003e If the error is not equal to nil (means error occurred). The result is always 0\n\n### Utilities\n\n**AppendSLeb128(x, y SLeb128) SLeb128**\n\nAppend two `Sleb128` into one `SLeb128`\n\n**AppendULeb128(x, y ULeb128) ULeb128**\n\nAppend two `Uleb128` into one `ULeb128`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzypeh%2Fgo-leb128","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzypeh%2Fgo-leb128","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzypeh%2Fgo-leb128/lists"}