{"id":14979996,"url":"https://github.com/bitcoin/libbase58","last_synced_at":"2025-10-02T18:31:01.341Z","repository":{"id":41986490,"uuid":"23354607","full_name":"bitcoin/libbase58","owner":"bitcoin","description":"C library for Bitcoin's base58 encoding","archived":false,"fork":true,"pushed_at":"2024-05-25T23:13:38.000Z","size":44,"stargazers_count":228,"open_issues_count":5,"forks_count":197,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-09-25T03:33:41.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"luke-jr/libbase58","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitcoin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-26T14:29:13.000Z","updated_at":"2024-09-23T18:18:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bitcoin/libbase58","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/bitcoin%2Flibbase58","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin%2Flibbase58/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin%2Flibbase58/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoin%2Flibbase58/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitcoin","download_url":"https://codeload.github.com/bitcoin/libbase58/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219875837,"owners_count":16554709,"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":[],"created_at":"2024-09-24T14:01:05.070Z","updated_at":"2025-10-02T18:30:56.070Z","avatar_url":"https://github.com/bitcoin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Initialisation\n--------------\n\nBefore you can use libbase58 for base58check, you must provide a SHA256\nfunction. The required function signature is:\n\n\tbool my_sha256(void *digest, const void *data, size_t datasz)\n\nSimply assign your function to b58_sha256_impl:\n\n\tb58_sha256_impl = my_sha256;\n\nThis is only required if base58check is used. Raw base58 does not need SHA256.\n\n\nDecoding Base58\n---------------\n\nSimply allocate a buffer to store the binary data in, and set a variable with\nthe buffer size, and call the b58tobin function:\n\n\tbool b58tobin(void *bin, size_t *binsz, const char *b58, size_t b58sz)\n\nThe \"canonical\" base58 byte length will be assigned to binsz on success, which\nmay be larger than the actual buffer if the input has many leading zeros.\nRegardless of the canonical byte length, the full binary buffer will be used.\nIf b58sz is zero, it will be initialised with strlen(b58); note that a true\nzero-length base58 string is not supported here.\n\n\nValidating Base58Check\n----------------------\n\nAfter calling b58tobin, you can validate base58check data using the b58check\nfunction:\n\n\tint b58check(const void *bin, size_t binsz, const char *b58, size_t b58sz)\n\nCall it with the same buffers used for b58tobin. If the return value is\nnegative, an error occurred. Otherwise, the return value is the base58check\n\"version\" byte from the decoded data.\n\n\nEncoding Base58\n---------------\n\nAllocate a string to store the base58 content, create a size_t variable with the\nsize of that allocation, and call:\n\n\tbool b58enc(char *b58, size_t *b58sz, const void *data, size_t binsz)\n\nNote that you must pass a pointer to the string size variable, not the size\nitself. When b58enc returns, the variable will be modified to contain the actual\nnumber of bytes used (including the null terminator). If encoding fails for any\nreason, or if the string buffer is not large enough for the result, b58enc will\nreturn false. Otherwise, it returns true to indicate success.\n\n\nEncoding Base58Check\n--------------------\n\nTargeting base58check is done similarly to raw base58 encoding, but you must\nalso provide a version byte:\n\n\tbool b58check_enc(char *b58c, size_t *b58c_sz, uint8_t ver,\n\t                  const void *data, size_t datasz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin%2Flibbase58","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoin%2Flibbase58","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin%2Flibbase58/lists"}