ok/jj
1
0
Fork 0
forked from mirrors/jj

cargo: upgrade blake2

This commit is contained in:
Martin von Zweigbergk 2022-02-09 22:01:13 -08:00
parent de6e77dcdf
commit 33cc6b1253
6 changed files with 36 additions and 33 deletions

41
Cargo.lock generated
View file

@ -53,13 +53,11 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "blake2"
version = "0.9.2"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174"
checksum = "b94ba84325db59637ffc528bbe8c7f86c02c57cff5c0e2b9b00f9a851f42f309"
dependencies = [
"crypto-mac",
"digest 0.9.0",
"opaque-debug 0.3.0",
"digest 0.10.1",
]
[[package]]
@ -74,6 +72,15 @@ dependencies = [
"generic-array 0.12.4",
]
[[package]]
name = "block-buffer"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
dependencies = [
"generic-array 0.14.4",
]
[[package]]
name = "block-padding"
version = "0.1.5"
@ -289,13 +296,12 @@ dependencies = [
]
[[package]]
name = "crypto-mac"
version = "0.8.0"
name = "crypto-common"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
dependencies = [
"generic-array 0.14.4",
"subtle",
]
[[package]]
@ -331,11 +337,14 @@ dependencies = [
[[package]]
name = "digest"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
dependencies = [
"block-buffer 0.10.2",
"crypto-common",
"generic-array 0.14.4",
"subtle",
]
[[package]]
@ -749,12 +758,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openssl-probe"
version = "0.1.4"
@ -1150,10 +1153,10 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
"opaque-debug 0.2.3",
"opaque-debug",
]
[[package]]

View file

@ -17,7 +17,7 @@ protobuf-codegen-pure = "2.25.2"
[dependencies]
backoff = "0.3.0"
blake2 = "0.9.2"
blake2 = "0.10.2"
bytes = "1.1.0"
byteorder = "1.4.3"
chrono = "0.4.19"

View file

@ -25,7 +25,7 @@ use std::ops::Bound;
use std::path::PathBuf;
use std::sync::Arc;
use blake2::{Blake2b, Digest};
use blake2::{Blake2b512, Digest};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use itertools::Itertools;
use tempfile::NamedTempFile;
@ -551,7 +551,7 @@ impl MutableIndex {
let hash_length = self.hash_length;
let buf = self.maybe_squash_with_ancestors().serialize();
let mut hasher = Blake2b::new();
let mut hasher = Blake2b512::new();
hasher.update(&buf);
let index_file_id_hex = hex::encode(&hasher.finalize());
let index_file_path = dir.join(&index_file_id_hex);

View file

@ -18,7 +18,7 @@ use std::fs::File;
use std::io::{ErrorKind, Read, Write};
use std::path::PathBuf;
use blake2::{Blake2b, Digest};
use blake2::{Blake2b512, Digest};
use protobuf::{Message, ProtobufError};
use tempfile::{NamedTempFile, PersistError};
@ -124,7 +124,7 @@ impl Backend for LocalBackend {
fn write_file(&self, _path: &RepoPath, contents: &mut dyn Read) -> BackendResult<FileId> {
let temp_file = NamedTempFile::new_in(&self.path)?;
let mut encoder = zstd::Encoder::new(temp_file.as_file(), 0)?;
let mut hasher = Blake2b::new();
let mut hasher = Blake2b512::new();
loop {
let mut buff: Vec<u8> = Vec::with_capacity(1 << 14);
let bytes_read;
@ -157,7 +157,7 @@ impl Backend for LocalBackend {
fn write_symlink(&self, _path: &RepoPath, target: &str) -> Result<SymlinkId, BackendError> {
let mut temp_file = NamedTempFile::new_in(&self.path)?;
temp_file.write_all(target.as_bytes())?;
let mut hasher = Blake2b::new();
let mut hasher = Blake2b512::new();
hasher.update(&target.as_bytes());
let id = SymlinkId::new(hasher.finalize().to_vec());
@ -186,7 +186,7 @@ impl Backend for LocalBackend {
temp_file.as_file().write_all(&proto_bytes)?;
let id = TreeId::new(Blake2b::digest(&proto_bytes).to_vec());
let id = TreeId::new(Blake2b512::digest(&proto_bytes).to_vec());
persist_content_addressed_temp_file(temp_file, self.tree_path(&id))?;
Ok(id)
@ -209,7 +209,7 @@ impl Backend for LocalBackend {
temp_file.as_file().write_all(&proto_bytes)?;
let id = CommitId::new(Blake2b::digest(&proto_bytes).to_vec());
let id = CommitId::new(Blake2b512::digest(&proto_bytes).to_vec());
persist_content_addressed_temp_file(temp_file, self.commit_path(&id))?;
Ok(id)
@ -232,7 +232,7 @@ impl Backend for LocalBackend {
temp_file.as_file().write_all(&proto_bytes)?;
let id = ConflictId::new(Blake2b::digest(&proto_bytes).to_vec());
let id = ConflictId::new(Blake2b512::digest(&proto_bytes).to_vec());
persist_content_addressed_temp_file(temp_file, self.conflict_path(&id))?;
Ok(id)

View file

@ -19,7 +19,7 @@ use std::fs::File;
use std::io::{ErrorKind, Write};
use std::path::PathBuf;
use blake2::{Blake2b, Digest};
use blake2::{Blake2b512, Digest};
use itertools::Itertools;
use protobuf::{Message, ProtobufError};
use tempfile::{NamedTempFile, PersistError};
@ -100,7 +100,7 @@ impl OpStore for SimpleOpStore {
temp_file.as_file().write_all(&proto_bytes)?;
let id = ViewId::new(Blake2b::digest(&proto_bytes).to_vec());
let id = ViewId::new(Blake2b512::digest(&proto_bytes).to_vec());
persist_content_addressed_temp_file(temp_file, self.view_path(&id))?;
Ok(id)
@ -123,7 +123,7 @@ impl OpStore for SimpleOpStore {
temp_file.as_file().write_all(&proto_bytes)?;
let id = OperationId::new(Blake2b::digest(&proto_bytes).to_vec());
let id = OperationId::new(Blake2b512::digest(&proto_bytes).to_vec());
persist_content_addressed_temp_file(temp_file, self.operation_path(&id))?;
Ok(id)

View file

@ -28,7 +28,7 @@ use std::io::{Cursor, Read, Write};
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
use blake2::{Blake2b, Digest};
use blake2::{Blake2b512, Digest};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use tempfile::NamedTempFile;
@ -330,7 +330,7 @@ impl MutableTable {
}
let buf = self.maybe_squash_with_ancestors().serialize();
let mut hasher = Blake2b::new();
let mut hasher = Blake2b512::new();
hasher.update(&buf);
let file_id_hex = hex::encode(&hasher.finalize());
let file_path = store.dir.join(&file_id_hex);