Skip to content

Commit

Permalink
diffie-hellman: fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Dec 14, 2024
1 parent 333e344 commit 25d9fe6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions exercises/practice/diffie-hellman/.meta/example.ua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PrivateKey ← ⍜(-2|⌊×)⊙⚂
PowMod ← ◿⊙(ⁿ:)
PublicKey ← PowMod
Secret ← PowMod
GeneratePrivateKey ← ⍜(-2|⌊×)⊙⚂
PowMod ← ◿⊙(ⁿ:)
PublicKey ← PowMod
Secret ← PowMod
2 changes: 1 addition & 1 deletion exercises/practice/diffie-hellman/diffie-hellman.ua
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 7 additions & 7 deletions exercises/practice/diffie-hellman/tests.ua
Original file line number Diff line number Diff line change
@@ -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|<P) [⍥(PrivateKey P) 1000]
⍤⤙≍ 1 /××⊃(≥2|<P) [⍥(GeneratePrivateKey P) 1000]

# Private key is random
P ← 7919
⍤⤙≍ 1 >100 ⧻◴ [⍥(PrivateKey P) 1000]
⍤⤙≍ 1 >100 ⧻◴ [⍥(GeneratePrivateKey P) 1000]

# Can calculate public key using private key
P ← 23
Expand All @@ -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
Expand Down

0 comments on commit 25d9fe6

Please sign in to comment.