From 5f57fd5068ff41ef6f50cca3ee55a9108cc34270 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Thu, 24 Feb 2022 21:51:11 +0100 Subject: [PATCH] Stuff2 --- ma5/rsa/rsa.rb | 1 + ma5/rsa/test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ma5/rsa/rsa.rb b/ma5/rsa/rsa.rb index 8dd2715..41e15b4 100644 --- a/ma5/rsa/rsa.rb +++ b/ma5/rsa/rsa.rb @@ -18,6 +18,7 @@ module RSA end end @e = enc.sample + p enc @d = RSA.n_inv(@e, @n) puts "e=#{@e} d=#{@d}" diff --git a/ma5/rsa/test.rb b/ma5/rsa/test.rb index 787ffc3..14017fc 100755 --- a/ma5/rsa/test.rb +++ b/ma5/rsa/test.rb @@ -3,7 +3,7 @@ require_relative "rsa" Primes = File.read("primes.txt").chomp.split(",").map do |pstr| - pstr.to_i + p = pstr.to_i end puts "Fetching random primes..." @@ -22,6 +22,6 @@ data.encrypt!(key.pubkey) puts "Encrypted bytes: #{data.raw}" data.decrypt!(key.privkey) -puts data.raw +puts "Decrypted bytes: #{data.raw}" p data.data