[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71940":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":13,"stars30d":13,"stars90d":13,"forks30d":13,"starsTrendScore":13,"compositeScore":14,"rankGlobal":8,"rankLanguage":8,"license":15,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":8,"pushedAt":8,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":13,"starSnapshotCount":13,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},71940,"hashsigs-py","QuipNetwork\u002Fhashsigs-py","QuipNetwork",null,"Python",11242,26,5,0,39.29,"GNU Affero General Public License v3.0",false,"main",true,[],"2026-06-12 02:02:56","# hashsigs (Python)\n\nPython package for WOTS+ with optional Rust acceleration from hashsigs-rs.\n\n## Installation\n\n```bash\npip install hashsigs\n```\n\nFor best performance, ensure you have Rust installed (the package will automatically build the Rust extension if available):\n\n```bash\n# Install Rust toolchain (optional, for better performance)\ncurl --proto '=https' --tlsv1.2 -sSf https:\u002F\u002Fsh.rustup.rs | sh\n# Then install hashsigs\npip install hashsigs\n```\n\n## Quick Usage\n\n```python\nimport hashsigs\n\n# Create a WOTS+ instance\nwots = hashsigs.WOTSPlus()\n\n# Generate a key pair\nprivate_key, public_key = wots.generate_key_pair()\n\n# Sign a message\nmessage = b\"Hello, world!\"\nsignature = wots.sign(private_key, message)\n\n# Verify the signature\nis_valid = wots.verify(public_key, message, signature)\nprint(f\"Signature valid: {is_valid}\")  # True\n\n# Check if Rust acceleration is available\ntry:\n    import hashsigs._rust\n    print(\"Using Rust acceleration\")\nexcept ImportError:\n    print(\"Using pure Python implementation\")\n```\n\n## Development Setup\n\nFor contributors and advanced users who want to build from source:\n\n```bash\n# from the repo root\npython3 -m venv .hashsigs\nsource .hashsigs\u002Fbin\u002Factivate\npython -m pip install -U pip pytest pytest-cov\n\n# Ensure Rust toolchain (required to build the optional extension)\n# macOS: also ensure Xcode CLT: xcode-select --install\nrustup --version || brew install rust\ncargo --version\n\n# Install dev deps and try to build rust extension (quote extras in zsh)\npip install -v -e '.[rust,dev]'\n# Install keccak provider (required for vectors when falling back to Python)\npip install pycryptodome\n# or: pip install pysha3\n\n# Quick check the extension is present (optional)\npython -c \"import hashsigs._rust as m; print('rust ext ok:', m)\"\n\n# Lint + type + tests with coverage; this is the full suite\npytest -q --cov=hashsigs --cov-report=term-missing\n```\n\nIf the Rust toolchain is not available, the above will fail on the rust-backed vector tests. See the “Test options” section for alternatives.\n\n## Test options\n\nYou can choose between three categories:\n\n- All Tests (vectors + rust-backed + lint + type + coverage) — fails if keccak or rust ext are missing\n  - pip install -e '.[rust,dev]' && pip install pycryptodome\n  - pytest -q\n\n- Basic (pure Python functionality only; requires keccak provider, but no Rust extension)\n  - pip install -e '.[dev]' pycryptodome\n  - HASHSIGS_BUILD_RUST=0 pytest -q -m \"not requires_rust\"\n\n- Basic (no keccak) — internal consistency tests only using hashlib.sha3_256; no vectors\n  - pip install -e '.[dev]'\n  - pytest -q -m \"not vectors\"\n\n## Troubleshooting\n\n- pysha3 build fails on Python 3.13 (macOS) with missing pystrhex.h\n  - Symptom: fatal error: 'pystrhex.h' file not found when building _pysha3\n  - Fix: install pycryptodome instead (preferred). Example: pip install pycryptodome\n  - Alternative: use Python 3.11\u002F3.12 where pysha3 wheels may exist, or wait for pysha3 to add 3.13 support\n\n- Rust extension won’t build\u002Fimport\n  - Ensure Rust toolchain is installed: curl https:\u002F\u002Fsh.rustup.rs -sSf | sh (or brew install rust)\n  - On macOS, ensure Xcode Command Line Tools are installed: xcode-select --install\n  - Clean and rebuild in your venv:\n    - pip uninstall -y hashsigs; pip install -e .[rust,dev]\n    - python -c \"import hashsigs._rust as m; print('rust ext ok', m)\"\n  - If it still fails, you can run Basic tests while you investigate: HASHSIGS_BUILD_RUST=0 pytest -q -m \"not requires_rust\"\n\n## Usage example\n\n```python\nfrom hashsigs import WOTSPlus\n\n# Prefer the Rust backend if available; falls back to Python keccak provider if not\nwots = WOTSPlus.keccak256(prefer_rust=True)\n\n# Derive a keypair from a 32-byte seed\nseed = bytes([1]) * 32\npk, sk = wots.generate_key_pair(seed)\n\n# Sign and verify a 32-byte message\nmsg = bytes([2]) * 32\nsig = wots.sign(sk, msg)\nassert wots.verify(pk, msg, sig)\nprint(\"Signature verifies!\")\n```\n\n### Quick self-check (from shell)\n\nRun a one-liner to confirm the package imports, the Rust extension is available (optional), and basic operations work:\n\n```bash\npython - \u003C\u003C'PY'\nfrom hashsigs import WOTSPlus\ntry:\n    import hashsigs._rust as _\n    print('Rust extension: available')\nexcept Exception:\n    print('Rust extension: not available (falling back to Python)')\n\nwots = WOTSPlus.keccak256(prefer_rust=True)\nseed = bytes([1]) * 32\npk, sk = wots.generate_key_pair(seed)\nmsg = bytes([2]) * 32\nsig = wots.sign(sk, msg)\nprint('verify:', wots.verify(pk, msg, sig))\nPY\n```\n\n## Rust backend\n\nWe now depend on the public crate and repository:\n- Crate: hashsigs-rs = \"0.0.2\"\n- Repo: https:\u002F\u002Fgithub.com\u002FQuipNetwork\u002Fhashsigs-rs\n\nThe Python bindings (PyO3) will attempt to build against the published crate during installation. If the build fails, the package still installs and falls back to pure Python.\n\n## License\n\nAGPL-3.0-or-later; see COPYING\n\n","hashsigs-py 是一个用于实现 WOTS+ 签名算法的 Python 包，可选支持 Rust 语言加速以提升性能。该项目的核心功能包括生成密钥对、签名消息以及验证签名，同时提供了灵活的安装选项，用户可以选择仅使用纯 Python 实现或通过安装 Rust 工具链来启用更高效的 Rust 扩展。适用于需要高效且安全地处理数字签名的应用场景，如区块链技术中的交易验证、数据完整性校验等。开发人员还可以根据自身需求选择不同级别的测试套件进行代码质量检查。",2,"2026-06-11 03:39:34","high_star"]