New backends: SHA512 SHA384 SHA256 SHA224

This commit is contained in:
Joey Hess 2011-03-01 17:07:15 -04:00
parent b7f4801801
commit 1b9c4477fb
8 changed files with 76 additions and 2 deletions

14
Backend/SHA224.hs Normal file
View file

@ -0,0 +1,14 @@
{- git-annex "SHA224" backend
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Backend.SHA224 (backend) where
import Types
import Backend.SHA
backend :: Backend Annex
backend = genBackend 224

14
Backend/SHA256.hs Normal file
View file

@ -0,0 +1,14 @@
{- git-annex "SHA256" backend
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Backend.SHA256 (backend) where
import Types
import Backend.SHA
backend :: Backend Annex
backend = genBackend 256

14
Backend/SHA384.hs Normal file
View file

@ -0,0 +1,14 @@
{- git-annex "SHA384" backend
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Backend.SHA384 (backend) where
import Types
import Backend.SHA
backend :: Backend Annex
backend = genBackend 384

14
Backend/SHA512.hs Normal file
View file

@ -0,0 +1,14 @@
{- git-annex "SHA512" backend
-
- Copyright 2011 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Backend.SHA512 (backend) where
import Types
import Backend.SHA
backend :: Backend Annex
backend = genBackend 512

View file

@ -10,6 +10,10 @@ module BackendList (allBackends) where
-- When adding a new backend, import it here and add it to the list.
import qualified Backend.WORM
import qualified Backend.SHA1
import qualified Backend.SHA256
import qualified Backend.SHA512
import qualified Backend.SHA224
import qualified Backend.SHA384
import qualified Backend.URL
import Types
@ -17,5 +21,9 @@ allBackends :: [Backend Annex]
allBackends =
[ Backend.WORM.backend
, Backend.SHA1.backend
, Backend.SHA256.backend
, Backend.SHA512.backend
, Backend.SHA224.backend
, Backend.SHA384.backend
, Backend.URL.backend
]

View file

@ -11,11 +11,17 @@ tests = [
, testCp "cp_p" "-p"
, testCp "cp_reflink_auto" "--reflink=auto"
, TestCase "uuid generator" $ selectCmd "uuid" ["uuid", "uuidgen"]
, TestCase "sha1sum" $ requireCmd "sha1sum" "sha1sum </dev/null"
, TestCase "xargs -0" $ requireCmd "xargs_0" "xargs -0 </dev/null"
, TestCase "rsync" $ requireCmd "rsync" "rsync --version >/dev/null"
, TestCase "unicode FilePath support" $ unicodeFilePath
]
] ++ shaTestCases [1, 256, 512, 224, 384]
shaTestCases :: [Int] -> [TestCase]
shaTestCases l = map make l
where
make n =
let cmd = "sha" ++ show n ++ "sum"
in TestCase cmd $ requireCmd cmd (cmd ++ " </dev/null")
tmpDir :: String
tmpDir = "tmp"

1
debian/changelog vendored
View file

@ -8,6 +8,7 @@ git-annex (0.22) UNRELEASED; urgency=low
* Support filenames that start with a dash; when such a file is passed
to a utility it will be escaped to avoid it being interpreted as an
option.
* New backends: SHA512 SHA384 SHA256 SHA224
-- Joey Hess <joeyh@debian.org> Sun, 13 Feb 2011 00:48:02 -0400

View file

@ -19,6 +19,9 @@ can use different backends for different files.
allows modifications of files to be tracked. Its need to generate checksums
can make it slower for large files.
for use.
* `SHA512`, `SHA384`, `SHA256`, `SHA224` -- Like SHA1, but larger
checksums. Mostly useful for the very paranoid, or anyone who is
researching checksum collisions and wants to annex their colliding data. ;)
* `URL` -- This backend downloads the file's content from an external URL.
The `annex.backends` git-config setting can be used to list the backends