Unified · Split
| @@ -9,6 +9,8 @@ · 8 unmodified lines | ||
| 9 | 9 | #include "fns.h" |
| 10 | 10 | #include "error.h" |
| 11 | 11 | |
| 12 | +#include <libsec.h> /* for sha1 in pathhash() */ | |
| 13 | + | |
| 12 | 14 | typedef struct DIR DIR; |
| 13 | 15 | typedef struct Ufsinfo Ufsinfo; |
| 14 | 16 | |
| @@ -65,11 +67,11 @@ unixtime(FILETIME *ft) · 50 unmodified lines | ||
| 65 | 67 | static uvlong |
| 66 | 68 | pathhash(TCHAR *p) |
| 67 | 69 | { |
| 68 | − uvlong h; | |
| 69 | − h = 0LL; | |
| 70 | − for(; *p; p++) | |
| 71 | − h += *p * 13; | |
| 72 | − return h; | |
| 70 | + uchar digest[SHA1dlen]; | |
| 71 | + int n; | |
| 72 | + for(n=0; p[n] != 0; n++); | |
| 73 | + sha1((uchar*)p, n*sizeof(TCHAR), digest, nil); | |
| 74 | + return *(uvlong*)digest; | |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | static ulong |