{"id":17702652,"url":"https://github.com/friendlymatthew/based64","last_synced_at":"2025-07-29T15:38:49.137Z","repository":{"id":253797859,"uuid":"843963049","full_name":"friendlymatthew/based64","owner":"friendlymatthew","description":"A base64 codec using wasm32 SIMD intrinsics.","archived":false,"fork":false,"pushed_at":"2024-11-22T18:15:43.000Z","size":82,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-20T22:32:43.720Z","etag":null,"topics":["base64","simd","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/friendlymatthew.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-08-18T00:29:54.000Z","updated_at":"2025-03-21T13:30:02.000Z","dependencies_parsed_at":"2024-08-23T22:27:24.337Z","dependency_job_id":"d622a658-86e4-42d3-9b05-17a9803373a1","html_url":"https://github.com/friendlymatthew/based64","commit_stats":null,"previous_names":["friendlymatthew/based64","friendlymatthew/base64","friendlymatthew/baste64"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlymatthew%2Fbased64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlymatthew%2Fbased64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlymatthew%2Fbased64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlymatthew%2Fbased64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/friendlymatthew","download_url":"https://codeload.github.com/friendlymatthew/based64/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253875870,"owners_count":21977514,"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":["base64","simd","wasm"],"created_at":"2024-10-24T19:08:38.450Z","updated_at":"2025-05-13T04:29:36.481Z","avatar_url":"https://github.com/friendlymatthew.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# based64\n\nA base64 codec using wasm32 SIMD intrinsics.\n\n```rust\nuse based64::{decode, encode};\nuse wasm_bindgen::{wasm_bindgen, JsValue};\n\n#[wasm_bindgen]\nfn main() -\u003e Result\u003c(), JsValue\u003e {\n  let ascii = b\"VGhlIGRvZyBsaWNrZWQgdGhlIG9pbCwgYW5kIGV2ZXJ5Ym9keSBsYXVnaGVkLg==\";\n  let message = decode(ascii)?; // The dog licked the oil, and everybody laughed.\n\n  let encoded_to_ascii = encode(\u0026message)?;\n  assert_eq!(encoded_to_ascii, ascii.to_vec());\n\n  Ok(())\n}\n```\n\nor\n```typescript\nimport init, {\n    encode,\n    decode,\n} from \"./pkg/based64.js\";\n\nasync function run(): boolean {\n    await init();\n    \n    let data = \"howdy\";\n    let bytes = new TextEncoder().encode(data);\n    let ascii: Uint8Array = encode(bytes);\n    let rawString = decode(ascii);\n    \n    return data === rawString;\n}\n```\n\n## Requirements\n\n```bash\n# make sure to have the wasm32 target installed\nrustup target add wasm32-unknown-unknown\n\nRUSTFLAGS=\\\"-C target-feature=+simd128 cargo test --target=wasm32-unknown-unknown\n```\n\n### Benchmarks\nTo run benchmarks, run `just bench`. It should lead you to a web page, you can view the console. \n\nThe benchmark rules are very simple, it must follow `window.btoa` and `window.atob`'s function header: `String` -\u003e `String`. \nSince certain functions have different function signatures, the work needed to convert into a `String` is included in the measurement. \n\nCodecs measured:\n- `base64` with `wasm_bindgen` bindings\n- `window.atob()`, `window.btoa()`\n- `based64` `Uint8Array` -\u003e `Uint8Array` with `wasm_bindgen` bindings\n- `based64` `String` -\u003e `String` with `wasm_bindgen` bindings\n\n## Resources\n\n- Mcyoung's [_Designing a SIMD Algorithm from Scratch_](https://mcyoung.xyz/2023/11/27/simd-base64/)\n- Daniel Lemire's [_Ridiculously fast base64 encoding and decoding_](https://lemire.me/blog/2018/01/17/ridiculously-fast-base64-encoding-and-decoding/)\n- [_core::arch::wasm32::v128_](https://doc.rust-lang.org/stable/core/arch/wasm32/struct.v128.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriendlymatthew%2Fbased64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriendlymatthew%2Fbased64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriendlymatthew%2Fbased64/lists"}