hashsum: replace rustc_serialize with hex crate

This commit is contained in:
Emiel Beinema 2017-10-14 00:09:09 +02:00
parent ff1ef82d84
commit 5d0c8895d9
4 changed files with 11 additions and 13 deletions

14
Cargo.lock generated
View file

@ -511,11 +511,11 @@ version = "0.0.1"
dependencies = [
"digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"md5 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -530,6 +530,11 @@ dependencies = [
"uucore 0.0.1",
]
[[package]]
name = "hex"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hostid"
version = "0.0.1"
@ -1011,11 +1016,6 @@ dependencies = [
"uucore 0.0.1",
]
[[package]]
name = "rustc-serialize"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc_version"
version = "0.1.7"
@ -1562,6 +1562,7 @@ dependencies = [
"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f"
"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa"
"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a"
"checksum itertools 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "772a0928a97246167d59a2a4729df5871f1327ab8b36fd24c4224b229cb47b99"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
@ -1588,7 +1589,6 @@ dependencies = [
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum remove_dir_all 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0882bc41b0ba6131c7f0ce97233b62d8099e3f3abc60d4938185d3e35439c0cc"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"

View file

@ -10,11 +10,11 @@ path = "hashsum.rs"
[dependencies]
digest = "0.6.2"
getopts = "0.2.14"
hex = "0.2.0"
libc = "0.2.26"
md5 = "0.3.5"
regex = "0.2.2"
regex-syntax = "0.4.1"
rustc-serialize = "0.3.24"
sha1 = "0.2.0"
sha2 = "0.6.0"
sha3 = "0.6.0"

View file

@ -1,11 +1,11 @@
extern crate digest;
extern crate md5;
extern crate rustc_serialize;
extern crate sha1;
extern crate sha2;
extern crate sha3;
use digest::digest::{Input, ExtendableOutput, XofReader};
use hex::ToHex;
pub trait Digest {
fn new() -> Self where Self: Sized;
@ -17,8 +17,6 @@ pub trait Digest {
(self.output_bits() + 7) / 8
}
fn result_str(&mut self) -> String {
use self::rustc_serialize::hex::ToHex;
let mut buf: Vec<u8> = vec![0; self.output_bytes()];
self.result(&mut buf);
buf.to_hex()

View file

@ -12,10 +12,10 @@
*/
extern crate getopts;
extern crate hex;
extern crate md5;
extern crate regex_syntax;
extern crate regex;
extern crate rustc_serialize as serialize;
extern crate sha1;
extern crate sha2;
extern crate sha3;
@ -26,9 +26,9 @@ extern crate uucore;
mod digest;
use digest::Digest;
use hex::ToHex;
use md5::Context as Md5;
use regex::Regex;
use serialize::hex::ToHex;
use sha1::Sha1;
use sha2::{Sha224, Sha256, Sha384, Sha512};
use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};