Skip to content

Instantly share code, notes, and snippets.

@yllan
Created April 15, 2012 04:41
Show Gist options
  • Select an option

  • Save yllan/2390092 to your computer and use it in GitHub Desktop.

Select an option

Save yllan/2390092 to your computer and use it in GitHub Desktop.
@tailrec def build(p: BigInt, g_inverse: BigInt, h_over_g_inverse_x1: BigInt, x1: Long, bound: Long, hash: Map[BigInt, Long]): Map[BigInt, Long] =
if (x1 > bound)
hash
else
build(p, g_inverse, (h_over_g_inverse_x1 * g_inverse).mod(p), x1 + 1, bound, hash + (h_over_g_inverse_x1 -> x1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment