Skip to content

Instantly share code, notes, and snippets.

@chfast
Created August 26, 2018 21:05
Show Gist options
  • Save chfast/e0e3768928ff2b62b09755fe8b9c5d43 to your computer and use it in GitHub Desktop.
Save chfast/e0e3768928ff2b62b09755fe8b9c5d43 to your computer and use it in GitHub Desktop.
Ethash 1a

Ethash 1a

  1. Define fnv1a() as
    def fnv1a(v1, v2):
        return ((v1 ^ v2) * FNV1A_PRIME) % 2**32
    where FNV1A_PRIME is 16777499 or 16777639.`
  2. Change the hash function that determines the DAG item index in Ethash algorighm from fnv() to new fnv1a(). In Main Loop change
    p = fnv(i ^ s[0], mix[i % w]) % (n // mixhashes) * mixhashes
    to
    p = fnv1a(i ^ s[0], mix[i % w]) % (n // mixhashes) * mixhashes
@jean-m-cyr
Copy link

fnv is used in both search and DAG gen. Worth mentioning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment