<commit_before>// Package seahash implements SeaHash algorithm
package seahash

import "hash"

// Size of SeaHash sum in bytes
const Size = 8

type digest struct {
	sum, a, b, c, d uint64
}

// New returns a new hash.Hash64 computing SeaHash
func New() hash.Hash64 {
	return &digest{
		0,
		0x16f11fe89b0d677c,
		0xb480a793d8e6c86c,
		0x6fe2e5aaf078ebc9,
		0x14f994a4c5259381,
	}
}

func diffuse(x uint64) uint64 {
	x *= 0x6eed0e9da4d94a4f
	a := x >> 32
	b := x >> 60
	x ^= a >> b
	x *= 0x6eed0e9da4d94a4f
	return x
}

func (d *digest) Write(p []byte) (n int, err error) {
	n = len(p)
	for len(p) > 0 {
		var q []byte
		if len(p) > Size {
			p, q = p[:Size], p[Size:]
		}
		var x uint64
		for i := len(p) - 1; i >= 0; i-- {
			x <<= 8
			x |= uint64(p[i])
		}
		d.a, d.b, d.c, d.d = d.b, d.c, d.d, diffuse(d.a^x)<commit_msg>Simplify<commit_after>// Package seahash implements SeaHash algorithm
package seahash

import "hash"

// Size of SeaHash sum in bytes
const Size = 8

type digest struct {
	sum, a, b, c, d uint64
}

// New returns a new hash.Hash64 computing SeaHash
func New() hash.Hash64 {
	return &digest{
		0,
		0x16f11fe89b0d677c,
		0xb480a793d8e6c86c,
		0x6fe2e5aaf078ebc9,
		0x14f994a4c5259381,
	}
}

func diffuse(x uint64) uint64 {
	x *= 0x6eed0e9da4d94a4f
	x ^= (x >> 32) >> (x >> 60)
	x *= 0x6eed0e9da4d94a4f
	return x
}

func (d *digest) Write(p []byte) (n int, err error) {
	n = len(p)
	for len(p) > 0 {
		var q []byte
		if len(p) > Size {
			p, q = p[:Size], p[Size:]
		}
		var x uint64
		for i := len(p) - 1; i >= 0; i-- {
			x <<= 8
			x |= uint64(p[i])
		}
		d.a, d.b, d.c, d.d = d.b, d.c, d.d, diffuse(d.a^x)
{'fraction_non_alphanumeric': 0.15450643776824036, 'fraction_numerical': 0.10300429184549356, 'mean_word_length': 2.9136690647482015, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5763985', 'n_tokens_mistral': 909, 'n_tokens_neox': 781, 'n_words': 215}