{"id":40554386,"url":"https://github.com/portal-co/asm-common","last_synced_at":"2026-01-21T00:32:02.516Z","repository":{"id":320172092,"uuid":"929124926","full_name":"portal-co/asm-common","owner":"portal-co","description":"Common types for assembly architectures","archived":false,"fork":false,"pushed_at":"2026-01-20T05:41:50.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-20T13:49:53.963Z","etag":null,"topics":["aarch64","amd64","arm64","armv6","armv7","armv8","asm","assembly","riscv","riscv32","riscv64","rv32","rv64","x64","x86"],"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/portal-co.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-07T21:14:04.000Z","updated_at":"2026-01-20T05:41:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a1ee45b-b36b-486c-b43f-7875c8630d58","html_url":"https://github.com/portal-co/asm-common","commit_stats":null,"previous_names":["portal-co/asm-common"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/portal-co/asm-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portal-co%2Fasm-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portal-co%2Fasm-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portal-co%2Fasm-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portal-co%2Fasm-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/portal-co","download_url":"https://codeload.github.com/portal-co/asm-common/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portal-co%2Fasm-common/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28619715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"ssl_error","status_checked_at":"2026-01-20T23:47:29.996Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["aarch64","amd64","arm64","armv6","armv7","armv8","asm","assembly","riscv","riscv32","riscv64","rv32","rv64","x64","x86"],"created_at":"2026-01-21T00:32:02.424Z","updated_at":"2026-01-21T00:32:02.495Z","avatar_url":"https://github.com/portal-co.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# portal-pc-asm-common\n\nCommon types and traits for assembly rewriting.\n\n[![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/)\n\n## Overview\n\n`portal-pc-asm-common` is a `no_std` Rust library that provides foundational types and traits for working with assembly-level operations, particularly for assembly rewriting and transformation tasks. The library is designed to be lightweight and portable, making it suitable for embedded systems and other constrained environments.\n\n## Features\n\n- **Arithmetic Operations**: Comprehensive support for arithmetic operations including add, subtract, multiply, divide, remainder, bitwise operations, and rotations\n- **Permission System**: Fine-grained permission tracking for code with read, write, execute, and no-jump permissions\n- **Register Abstractions**: Type-safe register representations\n- **Memory Operations**: Memory sizing and addressing types\n- **Value Types**: Bit-width aware value representations with constant support\n- **Ratchet**: Cryptographic seed ratcheting mechanism using SHA3-256 (optional feature)\n- **Serialization**: Optional serde support for all types\n- **No Standard Library**: Fully `no_std` compatible for embedded and constrained environments\n\n## Optional Features\n\n- `enum-map`: Enables `enum_map::Enum` derives for enum types\n- `exhaust`: Enables `exhaust::Exhaust` derives for exhaustive iteration\n- `serde`: Enables serialization and deserialization support\n- `alloc`: Enables allocating types like `Input` and `Vec` support\n- `sha3`: Enables SHA3 hashing support\n- `ratchet`: Enables the ratchet module (requires `sha3` feature)\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nportal-pc-asm-common = \"0.1.1\"\n```\n\nWith optional features:\n\n```toml\n[dependencies]\nportal-pc-asm-common = { version = \"0.1.1\", features = [\"serde\", \"alloc\"] }\n```\n\n## Usage\n\n### Basic Arithmetic Operations\n\n```rust\nuse portal_pc_asm_common::types::ops::{Arith, Sign};\n\n// Define arithmetic operations\nlet add_op = Arith::Add;\nlet signed_div = Arith::Div(Sign::Signed);\nlet unsigned_shr = Arith::Shr(Sign::Unsigned);\n```\n\n### Working with Permissions\n\n```rust\nuse portal_pc_asm_common::types::perms::{Perm, Perms};\n\n// Create permission sets\nlet perms = Perms {\n    r: true,   // Read permission\n    w: false,  // No write permission\n    x: true,   // Execute permission\n    nj: false, // Not marked as no-jump\n};\n```\n\n### Register Operations\n\n```rust\nuse portal_pc_asm_common::types::reg::Reg;\n\n// Define registers\nlet r0 = Reg(0);\nlet ctx = Reg::CTX;  // Special context register (255)\n\n// Normalize to 32 registers\nlet normalized = r0.r32();\n```\n\n### Memory Operations\n\n```rust\nuse portal_pc_asm_common::types::mem::{MemorySize, MemorySized};\n\n// Define memory operations with size\nlet mem_op = MemorySized {\n    value: 0x1234,\n    size: MemorySize::_64,\n};\n```\n\n### Value Types with Bitness\n\n```rust\nuse portal_pc_asm_common::types::value::{Bitness, Value, Constant};\n\n// Define bit width\nlet bitness = Bitness { log2: 6 }; // 2^6 = 64 bits\n\n// Create a value with offset\nlet value = Value {\n    offset: 0x100,\n    bitness,\n};\n\n// Work with constants\nlet constant = Constant {\n    data: [0; 8], // 512-bit constant\n};\n```\n\n### Using the Ratchet (with `ratchet` feature)\n\n```rust\n#[cfg(feature = \"ratchet\")]\nuse portal_pc_asm_common::ratchet::Ratchet;\n\n#[cfg(feature = \"ratchet\")]\n{\n    // Create a ratchet from a seed\n    let mut ratchet = Ratchet::from_seed([0u8; 32]);\n    \n    // Generate next value in sequence\n    let next_value = ratchet.next();\n    \n    // Split data using ratchet markers\n    let data = b\"chunk1\\x00\\x00...chunk2...\";\n    let chunks: Vec\u003c\u0026[u8]\u003e = ratchet.split(data).collect();\n}\n```\n\n### Working with Input Streams (with `alloc` feature)\n\n```rust\n#[cfg(feature = \"alloc\")]\nuse portal_pc_asm_common::types::perms::{Input, InputRef, InputStream, Perms};\n#[cfg(feature = \"alloc\")]\nuse bitvec::vec::BitVec;\n\n#[cfg(feature = \"alloc\")]\n{\n    // Create an input with code and permissions\n    let code = vec![0x90, 0x90]; // NOP instructions\n    let perms = Perms {\n        r: BitVec::repeat(true, 2),\n        w: BitVec::repeat(false, 2),\n        x: BitVec::repeat(true, 2),\n        nj: BitVec::repeat(false, 2),\n    };\n    \n    let input = Input::new(code, perms).unwrap();\n}\n```\n\n## Module Structure\n\n- `types`: Core type definitions\n  - `ops`: Arithmetic operations, signedness, endianness, and comparisons\n  - `perms`: Permission types and input stream abstractions\n  - `reg`: Register abstractions\n  - `mem`: Memory sizing types\n  - `value`: Bit-width aware value types and constants\n- `ratchet`: Cryptographic seed ratcheting (optional, requires `ratchet` feature)\n\n## API Documentation\n\nFor detailed API documentation, run:\n\n```bash\ncargo doc --open\n```\n\nOr with all features:\n\n```bash\ncargo doc --all-features --open\n```\n\n## no_std Support\n\nThis library is `no_std` by default. For allocation support in `no_std` environments, enable the `alloc` feature:\n\n```toml\n[dependencies]\nportal-pc-asm-common = { version = \"0.1.1\", features = [\"alloc\"], default-features = false }\n```\n\n## License\n\nThis project is licensed under CC0-1.0 - see the [LICENSE](LICENSE) file for details or visit [Creative Commons CC0](http://creativecommons.org/publicdomain/zero/1.0/).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit pull requests or open issues.\n\n## Version History\n\n- **0.1.1**: Current version with hash and debug implementations\n- **0.1.0**: Initial release\n\n## Notes\n\nSome reexports in the `types` module are deprecated since version 0.1.1 and will be removed in the next minor release. Use the submodules directly:\n\n- Instead of `use portal_pc_asm_common::types::*`, use `use portal_pc_asm_common::types::ops::*`\n- Access permission types via `use portal_pc_asm_common::types::perms::*`\n- Access value types via `use portal_pc_asm_common::types::value::*`\n\n## Goals\n- [ ] Maintain consistent common types for `asm-*` crates\n- [ ] Optimize bit-level operations for embedded use\n- [ ] Extend trait coverage for new architectures\n\n## Progress\n- [ ] Core types implemented (Arith, Perms, Reg, Mem, Value)\n- [ ] Ratchet and Serde support available via features\n- [ ] Documentation and examples provided\n\n---\n*AI assisted*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportal-co%2Fasm-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportal-co%2Fasm-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportal-co%2Fasm-common/lists"}