Skip to content

Conversions#219

Closed
ycscaly wants to merge 11 commits into
RustCrypto:masterfrom
ycscaly:conversions
Closed

Conversions#219
ycscaly wants to merge 11 commits into
RustCrypto:masterfrom
ycscaly:conversions

Conversation

@ycscaly

@ycscaly ycscaly commented Apr 30, 2023

Copy link
Copy Markdown
Contributor

Implements conversion across different Uxxx types. This allows what was previously e.g.

let u: U128 = transcript.challenge(b"u");

let u: U256 = U128::ZERO.concat(&u);
let u: U512 = U256::ZERO.concat(&u);
let u: U1024 = U512::ZERO.concat(&u);
let u: U2048 = U1024::ZERO.concat(&u);
let u: U4096 = U2048::ZERO.concat(&u);

To become:

let u: U128 = transcript.challenge(b"u");
let u: U4096 = u.to_u4096;

@ycscaly

ycscaly commented Apr 30, 2023

Copy link
Copy Markdown
Contributor Author

Resolves #220

Comment thread Cargo.toml Outdated
@tarcieri

Copy link
Copy Markdown
Member

It seems like this would be better implemented in terms of the From trait.

@ycscaly

ycscaly commented Apr 30, 2023

Copy link
Copy Markdown
Contributor Author

It seems like this would be better implemented in terms of the From trait.

Agreed

It seems like this would be better implemented in terms of the From trait.

Agreed, this also allowed me to drop the paste dependency.

Should be good now

@ycscaly ycscaly requested a review from tarcieri April 30, 2023 16:16
@ycscaly

ycscaly commented May 7, 2023

Copy link
Copy Markdown
Contributor Author

Replaced by #230

@ycscaly ycscaly closed this May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants