From 683cb13779d7155296608c1bfc2049c41d7f34c5 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 28 Feb 2022 10:10:45 +0100 Subject: [PATCH] Inspect for keys --- ma5/rsa/rsa.rb | 4 ++++ ma5/rsa/test.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/ma5/rsa/rsa.rb b/ma5/rsa/rsa.rb index 46dcc8b..04136d1 100644 --- a/ma5/rsa/rsa.rb +++ b/ma5/rsa/rsa.rb @@ -35,6 +35,10 @@ module RSA @d = RSA.modinv(@e, @phi) end + def inspect + "n=#{@n}" + end + def pubkey return @e, @n end diff --git a/ma5/rsa/test.rb b/ma5/rsa/test.rb index 57700bd..ba4b8e4 100755 --- a/ma5/rsa/test.rb +++ b/ma5/rsa/test.rb @@ -36,6 +36,7 @@ puts "p1=#{p1}, p2=#{p2}" puts key = RSA::Key.new(p1, p2) +puts key.inspect print "Message to be encrypted: " msg = gets.chomp