Compare commits
No commits in common. "535629ec40f26576dfca4a8c9c2f5c5fc0b30266" and "b7a063ddb44487dd41f63f916c6685e913864dc0" have entirely different histories.
535629ec40
...
b7a063ddb4
3 changed files with 1211 additions and 32 deletions
|
@ -7,7 +7,7 @@ MIN_8S = 5
|
|||
def expand(set)
|
||||
cased = set + set.map(&:downcase) + set.map(&:upcase)
|
||||
spaced = cased + cased.map { _1.gsub(/\s/, ' ') } + cased.map { _1.gsub(/\s/, "\n") } + cased.flat_map do |amulet|
|
||||
100.times.map { amulet.gsub(/\s/) { rand(2).zero? ? ' ' : "\n" } }
|
||||
20.times.map { amulet.gsub(/\s/) { rand(2).zero? ? ' ' : "\n" } }
|
||||
end
|
||||
spaced + spaced.flat_map { _1.match?(/[.?!]$/) ? [_1.gsub('.', '?'), _1.gsub('?', '.')] : ["#{_1}.", "#{_1}?"] }
|
||||
end
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
require 'digest'
|
||||
|
||||
def prompt(*args)
|
||||
print(*args)
|
||||
gets.chomp
|
||||
end
|
||||
|
||||
WHITESPACE = " \t\u200b\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000"
|
||||
|
||||
def doit(message, regex, limit = 10)
|
||||
return unless limit > 0
|
||||
|
||||
digest = Digest::SHA256.hexdigest message
|
||||
if regex.match? digest
|
||||
p message
|
||||
puts digest
|
||||
exit 0
|
||||
end
|
||||
|
||||
WHITESPACE.each_char do |ws|
|
||||
doit(message + ws, regex, limit - 1)
|
||||
end
|
||||
end
|
||||
|
||||
message = prompt "Message: "
|
||||
hash_regex = Regexp.new(prompt "Digest regex: ")
|
||||
|
||||
doit(message, hash_regex)
|
||||
|
||||
puts "i give up :("
|
||||
exit 1
|
Loading…
Reference in a new issue