History

devfs-win32: use sha1() for pathhash

cinap_lenrek committed 10 years ago

Commit 969f1e11 parent 693b8861 file · +7 −5Browse files

Unified · Split

kern/devfs-win32.c+7−5
@@ -9,6 +9,8 @@ · 8 unmodified lines
99 #include "fns.h"
1010 #include "error.h"
1111
12+#include <libsec.h> /* for sha1 in pathhash() */
13+
1214 typedef struct DIR DIR;
1315 typedef struct Ufsinfo Ufsinfo;
1416
@@ -65,11 +67,11 @@ unixtime(FILETIME *ft) · 50 unmodified lines
6567 static uvlong
6668 pathhash(TCHAR *p)
6769 {
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;
7375 }
7476
7577 static ulong

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t