Main idea:```name = gets.stripname_hash = Digest::SHA2.hexdigest namechash = name_hash.consistent_hashrand = Random.new(chash)...x[0] = rand.rand(600000)...k[0] = (a*x[0] + m) % p```We need to create such `name` which seed leads to generating of `x[0]==0`. This way, exposed `k[0] = (a*0+m)%p = m%p = m`One of such names is `aaaajvki`.
Full solution:```#!/usr/bin/ruby
require 'digest'require 'consistent_hash'
def bin_to_hex(s)    s.each_byte.map { |b| b.to_s(16) }.joinend
flag = 'aaa'p = 2**127 - 1m = bin_to_hex(flag).hex
puts(m)
raise "Incorrect flag" unless m < p
$i = 0
name0 = ""
c1 = c2 = c3 = c4 = c5 = c6 = c7 = c8 = 'a'.ord
while c1 <= 'z'.ord do    while c2 <= 'z'.ord do        while c3 <= 'z'.ord do            while c4 <= 'z'.ord do                while c5 <= 'z'.ord do                    while c6 <= 'z'.ord do                        while c7 <= 'z'.ord do                            while c8 <= 'z'.ord do                                name = c1.chr + c2.chr + c3.chr + c4.chr + c5.chr + c6.chr + c7.chr + c8.chr                                # puts(name)                                name_hash = Digest::SHA2.hexdigest name                                chash = name_hash.consistent_hash                                rand = Random.new(chash)
                                a = rand(2..(p - 1))
                                x = []                                k = []
                                x[0] = rand.rand(600000)                                if x[0] == 0 then                                    puts(name)                                    # k[0] = (a*x[0] + m) % p                                    # puts(k[0])                                    # exit                                end                                c8 += 1                            end                            c7 += 1                            c8 = 'a'.ord                        end                        c6 += 1                        c7 = c8 = 'a'.ord                    end                    c5 += 1                    c6 = c7 = c8 = 'a'.ord                end                c4 += 1                c5 = c6 = c7 = c8 = 'a'.ord            end            c3 += 1            c4 = c5 = c6 = c7 = c8 = 'a'.ord        end        c2 += 1        c3 = c4 = c5 = c6 = c7 = c8 = 'a'.ord    end    c1 += 1    c2 = c3 = c4 = c5 = c6 = c7 = c8 = 'a'.ordend```