From a59cfca5f190c44403dfc7449c678a2aa1626bb4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 4 Apr 2017 15:52:46 -0700 Subject: [PATCH] Upgrade "arc upload" to use SHA256 Summary: Fixes T12464. Moves "arc upload" to SHA256 where applicable. Test Plan: Ran `arc upload` against a server with D17620 twice, saw it skip the actual upload the second time. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12464 Differential Revision: https://secure.phabricator.com/D17622 --- src/upload/ArcanistFileDataRef.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/upload/ArcanistFileDataRef.php b/src/upload/ArcanistFileDataRef.php index 1a79e143..99ed03d9 100644 --- a/src/upload/ArcanistFileDataRef.php +++ b/src/upload/ArcanistFileDataRef.php @@ -346,11 +346,23 @@ final class ArcanistFileDataRef extends Phobject { } private function newFileHash($path) { - return null; + $hash = hash_file('sha256', $path, $raw_output = false); + + if ($hash === false) { + return null; + } + + return $hash; } private function newDataHash($data) { - return null; + $hash = hash('sha256', $data, $raw_output = false); + + if ($hash === false) { + return null; + } + + return $hash; } }