diff --git a/exercises/practice/diffie-hellman/.meta/example.ua b/exercises/practice/diffie-hellman/.meta/example.ua index 561643d..dc145b2 100644 --- a/exercises/practice/diffie-hellman/.meta/example.ua +++ b/exercises/practice/diffie-hellman/.meta/example.ua @@ -1,4 +1,4 @@ -PrivateKey ← ⍜(-2|⌊×)⊙⚂ -PowMod ← ◿⊙(ⁿ:) -PublicKey ← PowMod -Secret ← PowMod +GeneratePrivateKey ← ⍜(-2|⌊×)⊙⚂ +PowMod ← ◿⊙(ⁿ:) +PublicKey ← PowMod +Secret ← PowMod diff --git a/exercises/practice/diffie-hellman/diffie-hellman.ua b/exercises/practice/diffie-hellman/diffie-hellman.ua index d078e70..7675ab9 100644 --- a/exercises/practice/diffie-hellman/diffie-hellman.ua +++ b/exercises/practice/diffie-hellman/diffie-hellman.ua @@ -1,6 +1,6 @@ # Generate a private key # Key ? PrimeP -PrivateKey ← |1 ⊙(⍤"Please implement PrivateKey" 0) +GeneratePrivateKey ← |1 ⊙(⍤"Please implement GeneratePrivateKey" 0) # Calculate the public key # PublicKey ? PrimeP PrimeG PrivateKey diff --git a/exercises/practice/diffie-hellman/tests.ua b/exercises/practice/diffie-hellman/tests.ua index 918fa45..f4a3b42 100644 --- a/exercises/practice/diffie-hellman/tests.ua +++ b/exercises/practice/diffie-hellman/tests.ua @@ -1,12 +1,12 @@ -~ "diffie-hellman.ua" ~ PrivateKey PublicKey Secret +~ "diffie-hellman.ua" ~ GeneratePrivateKey PublicKey Secret # Private key is greater than 1 and less than p P ← 7919 -⍤⤙≍ 1 /××⊃(≥2|
100 ⧻◴ [⍥(PrivateKey P) 1000] +⍤⤙≍ 1 >100 ⧻◴ [⍥(GeneratePrivateKey P) 1000] # Can calculate public key using private key P ← 23 @@ -27,11 +27,11 @@ MyPrivateKey ← 6 ⍤⤙≍ 2 Secret P TheirPublicKey MyPrivateKey # Key exchange -P ← 23 -G ← 5 -AlicePrivateKey ← PrivateKey P +P ← 7919 +G ← 1553 +AlicePrivateKey ← GeneratePrivateKey P AlicePublicKey ← PublicKey P G AlicePrivateKey -BobPrivateKey ← PrivateKey P +BobPrivateKey ← GeneratePrivateKey P BobPublicKey ← PublicKey P G BobPrivateKey SecretA ← Secret P BobPublicKey AlicePrivateKey SecretB ← Secret P AlicePublicKey BobPrivateKey