diff options
author | Nadrieril | 2020-11-01 18:50:09 +0000 |
---|---|---|
committer | GitHub | 2020-11-01 18:50:09 +0000 |
commit | 2ae979a22ee4b79590f74110d61164383c7b5182 (patch) | |
tree | 5286606d6d59f5d5d4b9ecb7f651c97d201a092e /dhall/src/syntax/ast | |
parent | 48037367933085ca9c1c67c8c59f311e2b21be6d (diff) | |
parent | e5381c9b76f1d88dedb4a453cd026c8e98be5533 (diff) |
Merge pull request #192 from Nadrieril/rework-caching
Diffstat (limited to '')
-rw-r--r-- | dhall/src/syntax/ast/expr.rs | 5 | ||||
-rw-r--r-- | dhall/src/syntax/ast/import.rs | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs index b1a978f..eba2735 100644 --- a/dhall/src/syntax/ast/expr.rs +++ b/dhall/src/syntax/ast/expr.rs @@ -178,10 +178,9 @@ impl Expr { } // Compute the sha256 hash of the binary form of the expression. - pub fn hash(&self) -> Result<Box<[u8]>, Error> { - use sha2::Digest; + pub fn sha256_hash(&self) -> Result<Box<[u8]>, Error> { let data = binary::encode(self)?; - Ok(sha2::Sha256::digest(&data).as_slice().into()) + Ok(crate::utils::sha256_hash(&data)) } } diff --git a/dhall/src/syntax/ast/import.rs b/dhall/src/syntax/ast/import.rs index c45fe51..69f4021 100644 --- a/dhall/src/syntax/ast/import.rs +++ b/dhall/src/syntax/ast/import.rs @@ -52,7 +52,7 @@ pub enum ImportMode { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Hash { - SHA256(Vec<u8>), + SHA256(Box<[u8]>), } /// Reference to an external resource |