about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-11-16T08·27+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-11-16T08·27+0000
commitb7f008fc353ea05c423fb571047144052ce691c3 (patch)
treed2d62977981a0ba8ab7efecab481d80e617f488b /src/libutil
parent9311ab76a523de516b6bc98afda9e4b790225514 (diff)
* Did something useful while waiting at IAD: reference scanning is now
  much faster.

Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/hash.cc6
-rw-r--r--src/libutil/hash.hh2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 271e63665b8f..71d4ba67e2c0 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -109,13 +109,15 @@ static unsigned char divMod(unsigned char * bytes, unsigned char y)
 
 
 // omitted: E O U T
-char chars[] = "0123456789abcdfghijklmnpqrsvwxyz";
+const string base32Chars = "0123456789abcdfghijklmnpqrsvwxyz";
 
 
 string printHash32(const Hash & hash)
 {
     Hash hash2(hash);
     unsigned int len = (hash.hashSize * 8 - 1) / 5 + 1;
+
+    const char * chars = base32Chars.c_str();
     
     string s(len, '0');
 
@@ -165,6 +167,8 @@ Hash parseHash32(HashType ht, const string & s)
 {
     Hash hash(ht);
 
+    const char * chars = base32Chars.c_str();
+
     for (unsigned int i = 0; i < s.length(); ++i) {
         char c = s[i];
         unsigned char digit;
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh
index 398b17421644..0a0dfed7eefe 100644
--- a/src/libutil/hash.hh
+++ b/src/libutil/hash.hh
@@ -15,6 +15,8 @@ const int md5HashSize = 16;
 const int sha1HashSize = 20;
 const int sha256HashSize = 32;
 
+extern const string base32Chars;
+
 
 struct Hash
 {