aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@localhost>2013-02-14 00:00:00 +0000
committerroot <root@localhost>2013-02-14 00:00:00 +0000
commitf1614d70ec93de80b87232d33ef3cb26f4432eeb (patch)
tree487e14cddaa2225428249193690094d86e79efc7
parentfc6d0b6e7152b54b32bee447b4e0773ec1d3d4df (diff)
downloadgit-remote-gcrypt-f1614d70ec93de80b87232d33ef3cb26f4432eeb.zip
git-remote-gcrypt-f1614d70ec93de80b87232d33ef3cb26f4432eeb.tar.gz
git-remote-gcrypt-f1614d70ec93de80b87232d33ef3cb26f4432eeb.tar.bz2
Parameterise type of hash used
-rwxr-xr-xgit-remote-gcrypt12
1 files changed, 6 insertions, 6 deletions
diff --git a/git-remote-gcrypt b/git-remote-gcrypt
index e421d85..0333983 100755
--- a/git-remote-gcrypt
+++ b/git-remote-gcrypt
@@ -15,9 +15,9 @@ export GITCEPTION="${GITCEPTION:-}+" # Reuse $Gref except when stacked
Gref="refs/gcrypt/gitception$GITCEPTION"
Gref_rbranch="refs/heads/master"
Repoid=
-Hashpfx=":SHA224:"
-Packpfx="pack $Hashpfx"
-Packkey_bytes=33
+Packkey_bytes=33 # 33 random bytes for passphrase, still compatible if changed
+Hashtype=SHA224 # incompatible if changed
+Packpfx="pack :${Hashtype}:"
Branchlist=
Packlist=
@@ -64,7 +64,7 @@ splitcolon()
prefix_=${1%%:*}
suffix_=${1#*:}
}
-repoidstr() { xecho "repo $Hashpfx$Repoid 1"; }
+repoidstr() { xecho "repo :${Hashtype}:$Repoid 1"; }
## gitception part
# Fetch giturl $1, file $2
@@ -261,7 +261,7 @@ genkey()
pack_hash()
{
local hash_=
- hash_=$(gpg --with-colons --print-md SHA224 | tr A-F a-f)
+ hash_=$(gpg --with-colons --print-md "$Hashtype" | tr A-F a-f)
hash_=${hash_#:*:}
xecho "${hash_%:}"
}
@@ -280,7 +280,7 @@ make_new_repo()
PUTREPO "$URL"
# We need a relatively short ID for URL+REPO
- # The manifest will be stored at SHA224(urlid_)
+ # The manifest will be stored at pack_hash($urlid_)
# Needed assumption: the same user should have no duplicate urlid_
# For now, we arbitrarily use 9 random bytes (72 bits)
urlid_=$(genkey 9 | tr '/+' 'Zz')