func TestOshashCollisions(t *testing.T) {
	buf1 := []byte("this is dumb")
	buf2 := []byte("dumb is this")
	size := int64(len(buf1))
	head := make([]byte, chunkSize)

	tail1 := make([]byte, chunkSize)
	copy(tail1[len(tail1)-len(buf1):], buf1)
	hash1, err := oshash(size, head, tail1)
	if err != nil {
		t.Errorf("TestOshashCollisions: Error from oshash: %v", err)
	}

	tail2 := make([]byte, chunkSize)
	copy(tail2[len(tail2)-len(buf2):], buf2)
	hash2, err := oshash(size, head, tail2)
	if err != nil {
		t.Errorf("TestOshashCollisions: Error from oshash: %v", err)
	}

	if hash1 != hash2 {
		t.Errorf("TestOshashCollisions: oshash(n, k, ... %v) =! oshash(n, k, ... %v)", buf1, buf2)
	}
}
// As oshash sums byte values, causing collisions is trivial.
As oshash sums byte values, causing collisions is trivial.
// As oshash sums byte values causing collisions is trivial .
func TestOshashCollisions(t *testing.T) {
	buf1 := []byte("this is dumb")
	buf2 := []byte("dumb is this")
	size := int64(len(buf1))
	head := make([]byte, chunkSize)
	tail1 := make([]byte, chunkSize)
	copy(tail1[len(tail1)-len(buf1):], buf1)
	hash1, err := oshash(size, head, tail1)
	if err != nil {
		t.Errorf("TestOshashCollisions: Error from oshash: %v", err)
	}
	tail2 := make([]byte, chunkSize)
	copy(tail2[len(tail2)-len(buf2):], buf2)
	hash2, err := oshash(size, head, tail2)
	if err != nil {
		t.Errorf("TestOshashCollisions: Error from oshash: %v", err)
	}
	if hash1 != hash2 {
		t.Errorf("TestOshashCollisions: oshash(n, k, ... %v) =! oshash(n, k, ... %v)", buf1, buf2)
	}
}
func TestOshashCollisions ( t * testing . T ) { buf1 := [ ] byte ( " " ) buf2 := [ ] byte ( " " ) size := int64 ( len ( buf1 ) ) head := make ( [ ] byte , chunkSize ) tail1 := make ( [ ] byte , chunkSize ) copy ( tail1 [ len ( tail1 ) - len ( buf1 ) : ] , buf1 ) hash1 , err := oshash ( size , head , tail1 ) if err != nil { t . Errorf ( " " , err ) } tail2 := make ( [ ] byte , chunkSize ) copy ( tail2 [ len ( tail2 ) - len ( buf2 ) : ] , buf2 ) hash2 , err := oshash ( size , head , tail2 ) if err != nil { t . Errorf ( " " , err ) } if hash1 != hash2 { t . Errorf ( " " , buf1 , buf2 ) } }
As oshash sums byte values, causing collisions is trivial.
As oshash sums byte values causing collisions is trivial .