Skip to content

Instantly share code, notes, and snippets.

@Orbyt

Orbyt/timing.rb Secret

Created October 16, 2018 17:04
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 Orbyt/d9ed93b8c8a62cb7fa576d65666c2644 to your computer and use it in GitHub Desktop.
Save Orbyt/d9ed93b8c8a62cb7fa576d65666c2644 to your computer and use it in GitHub Desktop.
require 'benchmark'
Benchmark.bmbm do |x|
x.report("No matches diff length") { "password123" == "321get"}
x.report("No matches same length") { "password123" == "321kmnktget"}
x.report("First matches") { "password123" == "p533melw321" }
x.report("First three matches") { "password123" == "pas3melw361" }
x.report("First six matches") { "password123" == "passwolw369" }
x.report("All matches") { "password123" == "password123" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment