Skip to content

Instantly share code, notes, and snippets.

@buccolo
Created December 10, 2011 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buccolo/1456036 to your computer and use it in GitHub Desktop.
Save buccolo/1456036 to your computer and use it in GitHub Desktop.
Brute-forcing Diffie-Hellman's secret exponent.
#!/usr/bin/ruby
p = 1373
B = 805
i = 1
brute = 1
target = 397
while (brute != target)
brute = B ** i % p
i = i + 1
end
puts i-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment