Giter Club home page Giter Club logo

go-farm's People

Contributors

dgryski avatar leventov avatar nicolaasuni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-farm's Issues

Fingerprint64 on same bytes don't match Google Guava implementation

When passing the same byte arrays to fingerprint64 in java and in go I'm getting different hashes.

This java code results in the hash 0a77beeabd04e23c

import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;

public class Fingerprint64Example {

    public static void main(String[] args) {

        byte[] bytes = {102, 111, 111, 102, 105, 108, 101, 110, 97, 109, 101, 61, 0, 116, 104, 101, 47, 102, 105, 108, 101, 44, 0, 59, 0};
        HashFunction hasher = Hashing.farmHashFingerprint64();
        HashCode hashCode = hasher.hashBytes(bytes);
        System.out.println(hashCode);
    }
}

This go code results in the hash 3ce204bdeabe770a

package main

import (
	"fmt"

	farm "github.com/dgryski/go-farm"
)

func main() {
	bytes := []byte{102, 111, 111, 102, 105, 108, 101, 110, 97, 109, 101, 61, 0, 116, 104, 101, 47, 102, 105, 108, 101, 44, 0, 59, 0}
	fmt.Printf("%x", farm.Fingerprint64(bytes))
}

Is this expected? Is there something I've overlooked?

Function hash32Len0to4 is returning different values than reference implementation

The function hash32Len0to4 is returning different values than the reference implementation.
I can see the following difference:
https://github.com/google/farmhash/blob/master/src/farmhash.cc#L1055
https://github.com/dgryski/go-farm/blob/master/farmhashcc.go#L30

In the original implementation v is a signed char and here is a uint32.
The function seems exploiting the overflow behaviour but I am not sure how to correctly reproduce this in golang.

Update Hash64 for compatibility with reference impementation

The pure-C++ version of Hash64 appears to now be based on the farmhashxo set of functions rather than the farmhashna set. This change probably happened with 1.1 and we didn't notice because we were only checking for compatibility with the fingerprint code.

avo core for Fingerprint32

uber/cadence uses Fingerprint32 extensively, as did ringpop-go. It seems likely then that they would benefit from a faster assembly version.

Create SECURITY.md

Hey there!

I belong to an open source security research community, and a member (@akincibor) has found an issue, but doesn’t know the best way to disclose it.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

unrecognized instruction "IMUL3L" with go1.9/1.10

# github.com/dgryski/go-farm
../../dgryski/go-farm/fp_amd64.s:455: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:457: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:462: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:464: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:502: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:504: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:509: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:511: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:516: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:518: unrecognized instruction "IMUL3L"
../../dgryski/go-farm/fp_amd64.s:557: unrecognized instruction "IMUL3L"
asm: too many errors

See https://travis-ci.org/dgraph-io/badger/jobs/520608511 for more information

Undeterministic fingerprint on the same string

While running a bank test on Badger, I narrowed down a failure on farm.Fingerprint method being used for conflict detection among keys. Produced this PR: dgraph-io/badger#593

A long-running test (over 4h at this point) is starting to look like this is indeed the fix.

Way to test:
badger bank test --dir=<some-dir> --dur=4h (with and without this PR)

The txn conflict detection code is here: https://github.com/dgraph-io/badger/blob/master/transaction.go#L147-L171

Notes from observation:

Comparing @ts=437427 with @ts=437428
Index: 92881. Account [{Id:92881 Bal:120}] -> [{Id:92881 Bal:115}]
Index: 94432. Account [{Id:94432 Bal:115}] -> [{Id:94432 Bal:120}]

2018/09/26 09:49:12 Balance did NOT match up. Expected: 10000000. Received: 9999995
Index: 57525. Account [{Id:57525 Bal:115}] -> [{Id:57525 Bal:120}]
Index: 94432. Account [{Id:94432 Bal:120}] -> [{Id:94432 Bal:110}]

So, both read $115. @ts=437428, 94332 acct went from 115 -> 120.
@ts=437443, 94332 acct went from the read 115 -> 110 (but the actual was 120).
This should have been a txn conflict. It seems like farm.Fingerprint might have
generated a non-deterministic hash.

If helpful, I could produce a main program which directly load tests farm.Fingerprint method over a million keys (similar to what Badger bank test is doing).

Compile issue on armv71

vendor/github.com/dgryski/go-farm/fp64_stub.go:7:6: Fingerprint64 redeclared in
        previous declaration at vendor/github.com/dgryski/go-farm/fp64_generic.g
vendor/github.com/dgryski/go-farm/fp64_stub.go:7:6: missing function body

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.