RSA code: Difference between revisions
m
→{{header|PowerShell}}
mNo edit summary |
|||
Line 999:
<lang PowerShell>
$n = [BigInt]::Parse("9516311845790656153499716760847001433441357")
$e = [
$d = [BigInt]::Parse("5617843187844953170308463622230283376298685")
$plaintextstring = "Hello, Rosetta!"
$plaintext = [
[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 = [
"As ASCII: $decoded"
</lang>
|