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

  1. package abstract_sql
  2. import (
  3. "crypto/md5"
  4. "io"
  5. )
  6. // returns a 64 bit big int
  7. func hashToLong(dir string) (v int64) {
  8. h := md5.New()
  9. io.WriteString(h, dir)
  10. b := h.Sum(nil)
  11. v += int64(b[0])
  12. v <<= 8
  13. v += int64(b[1])
  14. v <<= 8
  15. v += int64(b[2])
  16. v <<= 8
  17. v += int64(b[3])
  18. v <<= 8
  19. v += int64(b[4])
  20. v <<= 8
  21. v += int64(b[5])
  22. v <<= 8
  23. v += int64(b[6])
  24. v <<= 8
  25. v += int64(b[7])
  26. return
  27. }