RSA code: Difference between revisions

m
mNo edit summary
Line 999:
<lang PowerShell>
$n = [BigInt]::Parse("9516311845790656153499716760847001433441357")
$e = [bigintBigint]::new(65537)
$d = [BigInt]::Parse("5617843187844953170308463622230283376298685")
$plaintextstring = "Hello, Rosetta!"
$plaintext = [System.Text.ASCIIEncoding]::ASCII.GetBytes($plaintextstring)
[bigint]$pt = [BigInt]::new($plaintext)
if ($n -lt $pt) {throw "`$n = $n < $pt = `$pt"}
Line 1,009:
$dc = [BigInt]::ModPow($ct, $d, $n)
"Decoded: $dc"
$decoded = [System.Text.ASCIIEncoding]::ASCII.GetString($dc.ToByteArray())
"As ASCII: $decoded"
</lang>
678

edits