kevinjqliu commented on code in PR #766:
URL:
https://github.com/apache/arrow-rs-object-store/pull/766#discussion_r3437879075
##########
src/client/crypto.rs:
##########
@@ -150,26 +124,24 @@ pub(crate) mod ring {
}
impl CryptoProvider for RingCryptoProvider {
- fn digest(&self, algorithm: DigestAlgorithm) -> Result<Box<dyn
DigestContext>> {
+ fn digest(&self, algorithm: DigestAlgorithm, data: &[&[u8]]) ->
Result<Vec<u8>> {
let algorithm = match algorithm {
DigestAlgorithm::Sha256 => &digest::SHA256,
};
- let ctx = digest::Context::new(algorithm);
- Ok(Box::new(RingDigestContext {
- ctx: Some(ctx),
- out: None,
- }))
+ let mut ctx = digest::Context::new(algorithm);
+ for chunk in data {
+ ctx.update(chunk);
+ }
+ Ok(ctx.finish().as_ref().to_vec())
}
- fn hmac(&self, algorithm: DigestAlgorithm, secret: &[u8]) ->
Result<Box<dyn HmacContext>> {
+ fn hmac(&self, algorithm: DigestAlgorithm, secret: &[u8], data: &[u8])
-> Result<Vec<u8>> {
let algorithm = match algorithm {
DigestAlgorithm::Sha256 => hmac::HMAC_SHA256,
};
let ctx = hmac::Context::with_key(&hmac::Key::new(algorithm,
secret));
Review Comment:
```suggestion
let mut ctx = hmac::Context::with_key(&hmac::Key::new(algorithm,
secret));
```
add mut, align with the other change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]