parent
d81c34cc54
commit
0a29864ab9
@ -0,0 +1,27 @@
|
|||||||
|
require 'digest/md5'
|
||||||
|
|
||||||
|
class Keys
|
||||||
|
attr_reader :seed, :hash
|
||||||
|
|
||||||
|
def initialize(seed)
|
||||||
|
@seed = seed
|
||||||
|
@hash = Hash.new {|h,k| Digest::MD5.hexdigest("#{seed}#{k}") }
|
||||||
|
end
|
||||||
|
|
||||||
|
def each
|
||||||
|
return enum_for(__method__) unless block_given?
|
||||||
|
|
||||||
|
(0..Float::INFINITY).each do |index|
|
||||||
|
next unless /(.)\1\1/ =~ hash[index]
|
||||||
|
|
||||||
|
needle = $1 * 5
|
||||||
|
stream = (1..1000).map {|i| hash[index + i] }
|
||||||
|
next unless stream.any? {|h| h.include?(needle) }
|
||||||
|
|
||||||
|
yield [index, hash[index]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
keys = Keys.new('qzyelonm')
|
||||||
|
p keys.each.take(64)
|
Loading…
Reference in new issue