Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 60 for sum64 (0.04 sec)

  1. src/hash/maphash/maphash_test.go

    		}
    	}
    
    	sum := hh[0].Sum64()
    	for i, h := range hh {
    		if sum != h.Sum64() {
    			t.Errorf("hash %d not identical to a single Write", i)
    		}
    	}
    
    	if sum1 := Bytes(hh[0].Seed(), b); sum1 != hh[0].Sum64() {
    		t.Errorf("hash using Bytes not identical to a single Write")
    	}
    
    	if sum1 := String(hh[0].Seed(), string(b)); sum1 != hh[0].Sum64() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 14 00:03:57 UTC 2023
    - 5.2K bytes
    - Viewed (0)
  2. src/hash/fnv/fnv.go

    func (s *sum32a) Reset()  { *s = offset32 }
    func (s *sum64) Reset()   { *s = offset64 }
    func (s *sum64a) Reset()  { *s = offset64 }
    func (s *sum128) Reset()  { s[0] = offset128Higher; s[1] = offset128Lower }
    func (s *sum128a) Reset() { s[0] = offset128Higher; s[1] = offset128Lower }
    
    func (s *sum32) Sum32() uint32  { return uint32(*s) }
    func (s *sum32a) Sum32() uint32 { return uint32(*s) }
    func (s *sum64) Sum64() uint64  { return uint64(*s) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat May 18 22:36:41 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  3. src/hash/maphash/example_test.go

    	var h maphash.Hash
    
    	// Add a string to the hash, and print the current hash value.
    	h.WriteString("hello, ")
    	fmt.Printf("%#x\n", h.Sum64())
    
    	// Append additional data (in the form of a byte array).
    	h.Write([]byte{'w', 'o', 'r', 'l', 'd'})
    	fmt.Printf("%#x\n", h.Sum64())
    
    	// Reset discards all data previously added to the Hash, without
    	// changing its seed.
    	h.Reset()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 24 01:59:55 UTC 2020
    - 933 bytes
    - Viewed (0)
  4. src/hash/maphash/maphash.go

    	h.n = 0
    }
    
    // Sum64 returns h's current 64-bit value, which depends on
    // h's seed and the sequence of bytes added to h since the
    // last call to [Hash.Reset] or [Hash.SetSeed].
    //
    // All bits of the Sum64 result are close to uniformly and
    // independently distributed, so it can be safely reduced
    // by using bit masking, shifting, or modular arithmetic.
    func (h *Hash) Sum64() uint64 {
    	h.initSeed()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 19:15:34 UTC 2023
    - 7.9K bytes
    - Viewed (0)
  5. pkg/util/hash/hash.go

    // Hash.Write error always return nil, this func simplify caller handle error
    func (i *instance) WriteString(s string) (n int) {
    	n, _ = i.hash.WriteString(s)
    	return
    }
    
    func (i *instance) Sum64() uint64 {
    	return i.hash.Sum64()
    }
    
    func (i *instance) Sum() string {
    	sum := i.hash.Sum(nil)
    	return hex.EncodeToString(sum)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Dec 21 20:24:14 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  6. test/escape_hash_maphash.go

    // Test escape analysis for hash/maphash.
    
    package escape
    
    import (
    	"hash/maphash"
    )
    
    func f() {
    	var x maphash.Hash // should be stack allocatable
    	x.WriteString("foo")
    	x.Sum64()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Nov 16 20:31:45 UTC 2019
    - 368 bytes
    - Viewed (0)
  7. src/hash/crc64/crc64_test.go

    				t.Errorf("could not unmarshal: %v", err)
    				continue
    			}
    
    			io.WriteString(h, g.in[len(g.in)/2:])
    			io.WriteString(h2, g.in[len(g.in)/2:])
    
    			if h.Sum64() != h2.Sum64() {
    				t.Errorf("ISO crc64(%s) = 0x%x != marshaled (0x%x)", g.in, h.Sum64(), h2.Sum64())
    			}
    		}
    	})
    	t.Run("ECMA", func(t *testing.T) {
    		table := MakeTable(ECMA)
    		for _, g := range golden {
    			h := New(table)
    			h2 := New(table)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 25 06:32:12 UTC 2018
    - 9.9K bytes
    - Viewed (0)
  8. pkg/util/hash/hash_test.go

    		t.Run(tt.name, func(t *testing.T) {
    			h := New()
    			h.Write([]byte(tt.str))
    			if gotStr := h.Sum(); tt.wantStr != gotStr {
    				t.Errorf("wantStr %v, but got %v", tt.wantStr, gotStr)
    			}
    			if gotUint64 := h.Sum64(); tt.wantUint64 != gotUint64 {
    				t.Errorf("wantUint64 %v, but got %v", tt.wantUint64, gotUint64)
    			}
    		})
    	}
    }
    
    func TestFactoryWriteString(t *testing.T) {
    	testCases := []struct {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Dec 21 20:24:14 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  9. src/hash/fnv/fnv_test.go

    		sum32 := h.(hash.Hash32).Sum32()
    		if sum32 != binary.BigEndian.Uint32(sum) {
    			t.Fatalf("Sum()=0x%x, but Sum32()=0x%x", sum, sum32)
    		}
    	case 8:
    		sum64 := h.(hash.Hash64).Sum64()
    		if sum64 != binary.BigEndian.Uint64(sum) {
    			t.Fatalf("Sum()=0x%x, but Sum64()=0x%x", sum, sum64)
    		}
    	case 16:
    		// There's no Sum128 function, so we don't need to test anything here.
    	}
    }
    
    func BenchmarkFnv32KB(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 01 21:04:12 UTC 2017
    - 7.3K bytes
    - Viewed (0)
  10. docs/debugging/hash-set/main.go

    		return -1
    	}
    	// use the faster version as per siphash docs
    	// https://github.com/dchest/siphash#usage
    	k0, k1 := binary.LittleEndian.Uint64(id[0:8]), binary.LittleEndian.Uint64(id[8:16])
    	sum64 := siphash.Hash(k0, k1, []byte(key))
    	return int(sum64 % uint64(cardinality))
    }
    
    // hashOrder - hashes input key to return consistent
    // hashed integer slice. Returned integer order is salted
    // with an input key. This results in consistent order.
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Mon Sep 19 18:05:16 UTC 2022
    - 3.7K bytes
    - Viewed (0)
Back to top