Inspect for keys

master
E. Almqvist 3 years ago
parent fdaf12ec58
commit 683cb13779
  1. 4
      ma5/rsa/rsa.rb
  2. 1
      ma5/rsa/test.rb

@ -35,6 +35,10 @@ module RSA
@d = RSA.modinv(@e, @phi) @d = RSA.modinv(@e, @phi)
end end
def inspect
"n=#{@n}"
end
def pubkey def pubkey
return @e, @n return @e, @n
end end

@ -36,6 +36,7 @@ puts "p1=#{p1}, p2=#{p2}"
puts puts
key = RSA::Key.new(p1, p2) key = RSA::Key.new(p1, p2)
puts key.inspect
print "Message to be encrypted: " print "Message to be encrypted: "
msg = gets.chomp msg = gets.chomp

Loading…
Cancel
Save