imageproc: Use DefaultHasher from stdlib instead of twox-hash

This commit is contained in:
Vojtech Kral 2018-06-23 16:48:37 +02:00 committed by Vincent Prouillet
parent a89768dab0
commit 3e4aa82ecc
23 changed files with 2 additions and 14 deletions

10
Cargo.lock generated
View file

@ -917,7 +917,6 @@ dependencies = [
"rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)", "tera 0.11.8 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0", "utils 0.1.0",
] ]
@ -2447,14 +2446,6 @@ dependencies = [
"trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "twox-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ucd-util" name = "ucd-util"
version = "0.1.1" version = "0.1.1"
@ -2927,7 +2918,6 @@ dependencies = [
"checksum trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d7c204ee231f802aa821f9dc2195aa0d0269ef7e9f8c844208565c9e3981e4" "checksum trust-dns-proto 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32d7c204ee231f802aa821f9dc2195aa0d0269ef7e9f8c844208565c9e3981e4"
"checksum trust-dns-resolver 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9b0a0c9d4f8dd56481209c5ae1a8965ed022461d352c81fb92466ec9d846929e" "checksum trust-dns-resolver 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9b0a0c9d4f8dd56481209c5ae1a8965ed022461d352c81fb92466ec9d846929e"
"checksum trust-dns-resolver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28b094ad60c4f51f36a493201d04d6605183c62bd5f0c73008a732f23950c156" "checksum trust-dns-resolver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28b094ad60c4f51f36a493201d04d6605183c62bd5f0c73008a732f23950c156"
"checksum twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "475352206e7a290c5fccc27624a163e8d0d115f7bb60ca18a64fc9ce056d7435"
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a" "checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"

View file

@ -9,7 +9,6 @@ regex = "1.0"
tera = "0.11.0" tera = "0.11.0"
image = "0.19.0" image = "0.19.0"
rayon = "0.9" rayon = "0.9"
twox-hash = "1.1"
errors = { path = "../errors" } errors = { path = "../errors" }
utils = { path = "../utils" } utils = { path = "../utils" }

View file

@ -3,7 +3,6 @@ extern crate lazy_static;
extern crate regex; extern crate regex;
extern crate image; extern crate image;
extern crate rayon; extern crate rayon;
extern crate twox_hash;
extern crate utils; extern crate utils;
extern crate errors; extern crate errors;
@ -12,13 +11,13 @@ use std::path::{Path, PathBuf};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::Entry as HEntry; use std::collections::hash_map::Entry as HEntry;
use std::collections::hash_map::DefaultHasher;
use std::fs::{self, File}; use std::fs::{self, File};
use regex::Regex; use regex::Regex;
use image::{GenericImage, FilterType}; use image::{GenericImage, FilterType};
use image::jpeg::JPEGEncoder; use image::jpeg::JPEGEncoder;
use rayon::prelude::*; use rayon::prelude::*;
use twox_hash::XxHash;
use utils::fs as ufs; use utils::fs as ufs;
use errors::{Result, ResultExt}; use errors::{Result, ResultExt};
@ -133,7 +132,7 @@ pub struct ImageOp {
impl ImageOp { impl ImageOp {
pub fn new(source: String, op: ResizeOp, quality: u8) -> ImageOp { pub fn new(source: String, op: ResizeOp, quality: u8) -> ImageOp {
let mut hasher = XxHash::with_seed(0); let mut hasher = DefaultHasher::new();
hasher.write(source.as_ref()); hasher.write(source.as_ref());
op.hash(&mut hasher); op.hash(&mut hasher);
hasher.write_u8(quality); hasher.write_u8(quality);

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB