about summary refs log tree commit diff
path: root/src/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-06-15T13·41+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-06-15T13·41+0000
commit21fe717ce2027187e553d1edec65ef68b5d3c702 (patch)
tree34ac1a94bb500f25793daba6f362c51240503ffe /src/util.cc
parentf66055fa1ef3eb208666b5ace7b5ab16bf7e8980 (diff)
* Refactoring: hash class.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/util.cc b/src/util.cc
index 4b7bbac3dd07..299fc942f2ef 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -27,53 +27,6 @@ string absPath(string filename, string dir)
 }
 
 
-static string printHash(unsigned char * buf)
-{
-    ostringstream str;
-    for (int i = 0; i < 16; i++) {
-        str.fill('0');
-        str.width(2);
-        str << hex << (int) buf[i];
-    }
-    return str.str();
-}
-
-    
-/* Verify that a reference is valid (that is, is a MD5 hash code). */
-bool isHash(const string & s)
-{
-    if (s.length() != 32) return false;
-    for (int i = 0; i < 32; i++) {
-        char c = s[i];
-        if (!((c >= '0' && c <= '9') ||
-              (c >= 'a' && c <= 'f')))
-            return false;
-    }
-    return true;
-}
-
-
-void checkHash(const string & s)
-{
-    if (!isHash(s)) throw BadRefError("invalid reference: " + s);
-}
-
-
-/* Compute the MD5 hash of a file. */
-string hashFile(string filename)
-{
-    unsigned char hash[16];
-    FILE * file = fopen(filename.c_str(), "rb");
-    if (!file)
-        throw BadRefError("file `" + filename + "' does not exist");
-    int err = md5_stream(file, hash);
-    fclose(file);
-    if (err) throw BadRefError("cannot hash file");
-    return printHash(hash);
-}
-
-
-
 /* Return the directory part of the given path, i.e., everything
    before the final `/'. */
 string dirOf(string s)