-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tran Hoang
committed
Mar 28, 2020
1 parent
f46419c
commit e75aae2
Showing
2 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
Go Murmur3 | ||
=== | ||
|
||
> Project được xây dựng nhằm mục đích giải quyết việc hash với seed là số âm trong golang | ||
Ouput | ||
--- | ||
|
||
* `Integer:` | ||
* `AsInt()` Trả về 1 số nguyên 32 bits được lấy từ 4 bytes đầu tiên của `ByteBuffer` | ||
* `String:` | ||
* `ToString()` Trả về 1 chuỗi 256 bits, được hash từ 16 bytes của `ByteBuffer` | ||
* `Bytes:` | ||
* `ToBytes()` Trả về mảng 16 bytes từ `H1` và `H2` sau khi hash | ||
* `AsBytes()` Trả về mảng 4 bytes đầu tiên của ToBytes theo thứ tự ngược lại | ||
|
||
Examples: | ||
|
||
```go | ||
m3_128 := murmur3.HashString(-1467523828, "681236075540516864") | ||
|
||
// AsInt() | ||
m3_128.AsInt() | ||
// output: -1239833368 | ||
|
||
// ToString() | ||
m3_128.ToString() | ||
// output: e8a419b6a02dd4769f55b02614e8644e | ||
|
||
// ToBytes() | ||
m3_128.ToBytes() | ||
// output: [232 164 25 182 160 45 212 118 159 85 176 38 20 232 100 78] | ||
|
||
// AsBytes() | ||
m3_128.AsBytes() | ||
// output: [182 25 164 232] | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters