Davide Galassi
1e9fd23776
Implement crypto byte array newtypes in term of a shared type ( #3684 )
...
Introduces `CryptoBytes` type defined as:
```rust
pub struct CryptoBytes<const N: usize, Tag = ()>(pub [u8; N], PhantomData<fn() -> Tag>);
```
The type implements a bunch of methods and traits which are typically
expected from a byte array newtype
(NOTE: some of the methods and trait implementations IMO are a bit
redundant, but I decided to maintain them all to not change too much
stuff in this PR)
It also introduces two (generic) typical consumers of `CryptoBytes`:
`PublicBytes` and `SignatureBytes`.
```rust
pub struct PublicTag;
pub PublicBytes<const N: usize, CryptoTag> = CryptoBytes<N, (PublicTag, CryptoTag)>;
pub struct SignatureTag;
pub SignatureBytes<const N: usize, CryptoTag> = CryptoBytes<N, (SignatureTag, CryptoTag)>;
```
Both of them use a tag to differentiate the two types at a higher level.
Downstream specializations will further specialize using a dedicated
crypto tag. For example in ECDSA:
```rust
pub struct EcdsaTag;
pub type Public = PublicBytes<PUBLIC_KEY_SERIALIZED_SIZE, EcdsaTag>;
pub type Signature = PublicBytes<PUBLIC_KEY_SERIALIZED_SIZE, EcdsaTag>;
```
Overall we have a cleaner and most importantly **consistent** code for
all the types involved
All these details are opaque to the end user which can use `Public` and
`Signature` for the cryptos as before
2024-03-19 15:47:42 +00:00
..
2024-03-15 07:46:09 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-11-13 19:14:41 +05:30
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-11-13 19:14:41 +05:30
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-11-30 12:15:46 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-10-10 16:02:35 +02:00
2023-12-07 09:57:43 +01:00
2024-02-28 07:32:02 +00:00
2024-02-28 07:32:02 +00:00
2023-08-30 15:45:49 +03:00
2023-12-08 11:10:26 +05:30
2023-08-30 15:45:49 +03:00
2024-01-30 23:17:44 +00:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2024-01-30 23:17:44 +00:00
2024-01-30 23:17:44 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2024-01-30 23:17:44 +00:00
2024-01-30 23:17:44 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-10-27 11:38:16 +02:00
2023-10-27 11:38:16 +02:00
2023-10-14 08:26:19 +02:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-09-22 12:48:48 +01:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-10-11 19:49:59 +02:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2024-03-11 20:39:21 +00:00
2023-08-30 15:45:49 +03:00
2024-03-19 15:47:42 +00:00
2023-08-30 15:45:49 +03:00
2024-03-19 15:47:42 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2023-12-07 09:57:43 +01:00
2023-08-30 15:45:49 +03:00
2024-02-28 02:13:09 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2024-01-30 23:17:44 +00:00
2024-01-30 23:17:44 +00:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-10 22:22:00 +01:00
2023-12-08 11:10:26 +05:30
2023-12-10 22:22:00 +01:00
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-10 22:22:00 +01:00
2023-12-08 11:10:26 +05:30
2023-12-10 22:22:00 +01:00
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-12-08 11:10:26 +05:30
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00
2023-08-30 15:45:49 +03:00