You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
399 B
32 lines
399 B
package abstract_sql
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"io"
|
|
)
|
|
|
|
// returns a 64 bit big int
|
|
func hashToLong(dir string) (v int64) {
|
|
h := md5.New()
|
|
io.WriteString(h, dir)
|
|
|
|
b := h.Sum(nil)
|
|
|
|
v += int64(b[0])
|
|
v <<= 8
|
|
v += int64(b[1])
|
|
v <<= 8
|
|
v += int64(b[2])
|
|
v <<= 8
|
|
v += int64(b[3])
|
|
v <<= 8
|
|
v += int64(b[4])
|
|
v <<= 8
|
|
v += int64(b[5])
|
|
v <<= 8
|
|
v += int64(b[6])
|
|
v <<= 8
|
|
v += int64(b[7])
|
|
|
|
return
|
|
}
|