pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/hash/example_test.go (about) 1 package hash 2 3 // ////////////////////////////////////////////////////////////////////////////////// // 4 // // 5 // Copyright (c) 2022 ESSENTIAL KAOS // 6 // Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // 7 // // 8 // ////////////////////////////////////////////////////////////////////////////////// // 9 10 import ( 11 "fmt" 12 ) 13 14 // ////////////////////////////////////////////////////////////////////////////////// // 15 16 func ExampleJCHash() { 17 var ( 18 key uint64 = 0xDEADBEEF 19 buckets int = 128 * 1024 20 ) 21 22 hash := JCHash(key, buckets) 23 24 fmt.Println(hash) 25 26 // Output: 27 // 110191 28 } 29 30 func ExampleFileHash() { 31 hash := FileHash("/path/to/some/file") 32 33 fmt.Println(hash) 34 }