Skip to content

Commit f770b0d

Browse files
authoredJul 21, 2024··
Merge pull request #136 from zkcrypto/digest-0.10
Migrate to `digest 0.10`
2 parents 2874b5a + 581d70d commit f770b0d

File tree

4 files changed

+59
-82
lines changed

4 files changed

+59
-82
lines changed
 

‎Cargo.lock

+22-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+27-47
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,37 @@
11
[package]
2+
name = "bls12_381"
3+
version = "0.8.0"
24
authors = [
35
"Sean Bowe <ewillbefull@gmail.com>",
46
"Jack Grigg <thestr4d@gmail.com>",
57
]
8+
edition = "2021"
9+
rust-version = "1.56"
610
description = "Implementation of the BLS12-381 pairing-friendly elliptic curve construction"
711
documentation = "https://docs.rs/bls12_381/"
812
homepage = "https://github.com/zkcrypto/bls12_381"
9-
license = "MIT/Apache-2.0"
10-
name = "bls12_381"
1113
repository = "https://github.com/zkcrypto/bls12_381"
12-
version = "0.8.0"
13-
edition = "2021"
14+
license = "MIT/Apache-2.0"
1415

1516
[package.metadata.docs.rs]
16-
rustdoc-args = [ "--html-in-header", "katex-header.html" ]
17+
rustdoc-args = ["--html-in-header", "katex-header.html"]
18+
19+
[dependencies]
20+
digest = { version = "0.10", optional = true }
21+
ff = { version = "0.13", default-features = false }
22+
group = { version = "0.13", optional = true, default-features = false }
23+
pairing = { version = "0.23", optional = true }
24+
rand_core = { version = "0.6", default-features = false }
25+
subtle = { version = "2.2.1", default-features = false }
26+
zeroize = { version = "1.4", optional = true, default-features = false }
1727

1828
[dev-dependencies]
1929
csv = ">= 1.0, < 1.2" # csv 1.2 has MSRV 1.60
2030
criterion = "0.3"
2131
hex-literal = "0.3"
2232
rand_xorshift = "0.3"
23-
sha2 = "0.9"
24-
sha3 = "0.9"
25-
26-
[[bench]]
27-
name = "groups"
28-
harness = false
29-
required-features = ["groups"]
30-
31-
[[bench]]
32-
name = "hash_to_curve"
33-
harness = false
34-
required-features = ["experimental"]
35-
36-
[dependencies.digest]
37-
version = "0.9"
38-
optional = true
39-
40-
[dependencies.ff]
41-
version = "0.13"
42-
default-features = false
43-
44-
[dependencies.group]
45-
version = "0.13"
46-
default-features = false
47-
optional = true
48-
49-
[dependencies.pairing]
50-
version = "0.23"
51-
optional = true
52-
53-
[dependencies.rand_core]
54-
version = "0.6"
55-
default-features = false
56-
57-
[dependencies.subtle]
58-
version = "2.2.1"
59-
default-features = false
60-
61-
[dependencies.zeroize]
62-
version = "1.4"
63-
default-features = false
64-
optional = true
33+
sha2 = "0.10"
34+
sha3 = "0.10"
6535

6636
[features]
6737
default = ["groups", "pairings", "alloc", "bits"]
@@ -83,3 +53,13 @@ required-features = ["experimental"]
8353
[[test]]
8454
name = "hash_to_curve_g2"
8555
required-features = ["experimental"]
56+
57+
[[bench]]
58+
name = "groups"
59+
harness = false
60+
required-features = ["groups"]
61+
62+
[[bench]]
63+
name = "hash_to_curve"
64+
harness = false
65+
required-features = ["experimental"]

‎RELEASES.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
## Changed
3+
- Bumped dependencies to `digest 0.10`.
24

35
# 0.8.0
46
## Changed

‎src/hash_to_curve/expand_msg.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
use core::fmt::{self, Debug, Formatter};
55

66
use digest::{
7-
generic_array::typenum::IsLess, BlockInput, ExtendableOutput, FixedOutput, Update, XofReader,
7+
core_api::BlockSizeUser, generic_array::typenum::IsLess, ExtendableOutput, FixedOutput,
8+
XofReader,
89
};
910

1011
use crate::generic_array::{
@@ -47,7 +48,7 @@ impl ExpandMsgDst {
4748
/// is used when handling DST values longer than 255 bytes.
4849
fn for_xof<H, L>(dst: &[u8]) -> Self
4950
where
50-
H: Default + Update + ExtendableOutput,
51+
H: Default + ExtendableOutput,
5152
L: ArrayLength<u8> + IsLess<U256>,
5253
{
5354
let input_len = dst.len();
@@ -72,7 +73,7 @@ impl ExpandMsgDst {
7273
/// reduce domain separation tags that are longer than 255 bytes.
7374
fn for_xmd<H>(dst: &[u8]) -> Self
7475
where
75-
H: Default + FixedOutput + Update,
76+
H: Default + FixedOutput,
7677
H::OutputSize: IsLess<U256>,
7778
{
7879
let input_len = dst.len();
@@ -178,7 +179,7 @@ impl<H: ExtendableOutput> Debug for ExpandMsgXof<H> {
178179

179180
impl<H> ExpandMessage for ExpandMsgXof<H>
180181
where
181-
H: Default + ExtendableOutput + Update,
182+
H: Default + ExtendableOutput,
182183
{
183184
fn init_expand<M, L>(message: M, dst: &[u8], len_in_bytes: usize) -> Self
184185
where
@@ -245,15 +246,15 @@ impl<H: FixedOutput> Debug for ExpandMsgXmd<H> {
245246

246247
impl<H> ExpandMessage for ExpandMsgXmd<H>
247248
where
248-
H: Default + BlockInput + FixedOutput + Update,
249+
H: Default + BlockSizeUser + FixedOutput,
249250
H::OutputSize: IsLess<U256>,
250251
{
251252
fn init_expand<M, L>(message: M, dst: &[u8], len_in_bytes: usize) -> Self
252253
where
253254
M: Message,
254255
L: ArrayLength<u8> + IsLess<U256>,
255256
{
256-
let hash_size = <H as FixedOutput>::OutputSize::to_usize();
257+
let hash_size = H::OutputSize::to_usize();
257258
let ell = (len_in_bytes + hash_size - 1) / hash_size;
258259
if ell > 255 {
259260
panic!("Invalid ExpandMsgXmd usage: ell > 255");
@@ -264,7 +265,7 @@ where
264265

265266
let dst = ExpandMsgDst::for_xmd::<H>(dst);
266267
let mut hash_b_0 =
267-
H::default().chain(GenericArray::<u8, <H as BlockInput>::BlockSize>::default());
268+
H::default().chain(GenericArray::<u8, <H as BlockSizeUser>::BlockSize>::default());
268269
message.input_message(|m| hash_b_0.update(m));
269270
let b_0 = hash_b_0
270271
.chain((len_in_bytes as u16).to_be_bytes())

0 commit comments

Comments
 (0)
Please sign in to comment.