#!/usr/bin/ruby

#####################################
#
# Marcin Woźniak
# s434812
#
#####################################

require 'socket'

load 'modul1.rb'

sock = TCPSocket.new("localhost",3000)
puts sock.gets


spec=specyficPrimaryNumber

p,q = spec[0], spec[1]

g = generator(p,q)

x = SecureRandom.random_number(2..p-2)
y = betterExponentiation(g,x,p)

privKey = [p, q, y]
pubKey = [p, x]

puts "privKey(p,q,y): " +  privKey.inspect
puts "pubKey(p,x): " + pubKey.inspect
puts
puts p.inspect.unpack('b*')
puts
sock.puts p.inspect.unpack("b*")
sock.puts x.inspect.unpack("b*")
sock.close
