Fossil SCM
Use MD5 to generate the color hash as it's a random function.
Commit
d4caf785e39715bacf89a86bb83fd0156a9cbbae069aa685b2cee352814487cc
Parent
bd4cec12403c65a…
1 file changed
+6
-2
+6
-2
| --- src/color.c | ||
| +++ src/color.c | ||
| @@ -298,12 +298,16 @@ | ||
| 298 | 298 | ** Compute a hash on a branch or user name |
| 299 | 299 | */ |
| 300 | 300 | static unsigned int hash_of_name(const char *z){ |
| 301 | 301 | unsigned int h = 0; |
| 302 | 302 | int i; |
| 303 | - for(i=0; z[i]; i++ ){ | |
| 304 | - h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; | |
| 303 | + const char *zHash; | |
| 304 | + md5sum_init(); | |
| 305 | + md5sum_step_text(z, -1); | |
| 306 | + zHash = md5sum_finish(0); | |
| 307 | + for( i=0; zHash[i]; i++ ){ | |
| 308 | + h += zHash[i] << i; | |
| 305 | 309 | } |
| 306 | 310 | return h; |
| 307 | 311 | } |
| 308 | 312 | |
| 309 | 313 | /* |
| 310 | 314 |
| --- src/color.c | |
| +++ src/color.c | |
| @@ -298,12 +298,16 @@ | |
| 298 | ** Compute a hash on a branch or user name |
| 299 | */ |
| 300 | static unsigned int hash_of_name(const char *z){ |
| 301 | unsigned int h = 0; |
| 302 | int i; |
| 303 | for(i=0; z[i]; i++ ){ |
| 304 | h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; |
| 305 | } |
| 306 | return h; |
| 307 | } |
| 308 | |
| 309 | /* |
| 310 |
| --- src/color.c | |
| +++ src/color.c | |
| @@ -298,12 +298,16 @@ | |
| 298 | ** Compute a hash on a branch or user name |
| 299 | */ |
| 300 | static unsigned int hash_of_name(const char *z){ |
| 301 | unsigned int h = 0; |
| 302 | int i; |
| 303 | const char *zHash; |
| 304 | md5sum_init(); |
| 305 | md5sum_step_text(z, -1); |
| 306 | zHash = md5sum_finish(0); |
| 307 | for( i=0; zHash[i]; i++ ){ |
| 308 | h += zHash[i] << i; |
| 309 | } |
| 310 | return h; |
| 311 | } |
| 312 | |
| 313 | /* |
| 314 |