mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-21 17:00:59 +00:00
Update sha dependencies
This commit is contained in:
parent
4bd4f0f797
commit
1c7c7ef51e
3 changed files with 14 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "http-signature-normalization-reqwest"
|
||||
description = "An HTTP Signatures library that leaves the signing to you"
|
||||
version = "0.3.1"
|
||||
version = "0.4.0"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
license-file = "LICENSE"
|
||||
readme = "README.md"
|
||||
|
@ -29,8 +29,8 @@ http = "0.2.0"
|
|||
http-signature-normalization = { version = "0.5.1", path = ".." }
|
||||
reqwest = { version = "0.11", default-features = false, features = ["json"] }
|
||||
reqwest-middleware = { version = "0.1.2", optional = true }
|
||||
sha2 = { version = "0.9", optional = true }
|
||||
sha3 = { version = "0.9", optional = true }
|
||||
sha2 = { version = "0.10", optional = true }
|
||||
sha3 = { version = "0.10", optional = true }
|
||||
thiserror = "1.0"
|
||||
tokio = { version = "1", default-features = false, features = ["rt"], optional = true }
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use sha2::{Sha224, Sha256, Sha384, Sha512, Sha512Trunc224, Sha512Trunc256};
|
||||
use sha2::{Sha224, Sha256, Sha384, Sha512};
|
||||
|
||||
use super::DigestCreate;
|
||||
|
||||
fn create(digest: &mut impl sha2::Digest, input: &[u8]) -> String {
|
||||
digest.update(input);
|
||||
fn create<D: sha2::Digest + sha2::digest::FixedOutputReset>(
|
||||
digest: &mut D,
|
||||
input: &[u8],
|
||||
) -> String {
|
||||
sha2::Digest::update(digest, input);
|
||||
base64::encode(&digest.finalize_reset())
|
||||
}
|
||||
|
||||
|
@ -38,19 +41,3 @@ impl DigestCreate for Sha512 {
|
|||
create(self, input)
|
||||
}
|
||||
}
|
||||
|
||||
impl DigestCreate for Sha512Trunc224 {
|
||||
const NAME: &'static str = "SHA-512-224";
|
||||
|
||||
fn compute(&mut self, input: &[u8]) -> String {
|
||||
create(self, input)
|
||||
}
|
||||
}
|
||||
|
||||
impl DigestCreate for Sha512Trunc256 {
|
||||
const NAME: &'static str = "SHA-512-256";
|
||||
|
||||
fn compute(&mut self, input: &[u8]) -> String {
|
||||
create(self, input)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,11 @@ use sha3::{
|
|||
|
||||
use super::DigestCreate;
|
||||
|
||||
fn create(digest: &mut impl sha3::Digest, input: &[u8]) -> String {
|
||||
digest.update(input);
|
||||
fn create<D: sha3::Digest + sha3::digest::FixedOutputReset>(
|
||||
digest: &mut D,
|
||||
input: &[u8],
|
||||
) -> String {
|
||||
sha3::Digest::update(digest, input);
|
||||
base64::encode(&digest.finalize_reset())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue