RustCrypto / RustCrypto/crypto-bigint

`HybridUint` for mix-match `Uint` in-struct

Open
#1,148 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
309
Forks
95
Avg merge
1d 14h
Merged PRs (30d)
3

Description

This could be a variant of "worst case" where the Limbs are MaybeUninit or heapless::Vec which uses MaybeUninit behind the scenes.

This would allow easier portability between BoxedUint and no-alloc variant without re-writing into fixed sizes whilst avoiding global alloc ? e.g. here:

Say there is:

struct Foo {
  a: HeaplessUint<2>, // U64/U128 Max
  b: HeaplessUint<1>, // U32/64 Max
}

It would be more memory efficient than:

struct Foo<U: Unsigned> {
  a: U
  b: U
}

Where used U can be U2048 | U4096 etc. in case which it takes double the space vs optimising through worst case.

And more flexible than relying on type-aliases:

struct Foo {
  a: U2048,
  b: U128,
}

Arguably it is just another form of Uint<Limbs> but Heapless is essentially optimizing through [MaybeUninit<Limb>; N]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Uint and HeaplessUint representations, including their use of MaybeUninit, then read the linked RustCrypto/RSA discussion for the portability context. A complete design should support mixed limb capacities within one struct without global allocation while improving on fixed worst-case storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.