lib/x25519/scalar.rb in x25519-1.0.8 vs lib/x25519/scalar.rb in x25519-1.0.9
- old
+ new
@@ -26,9 +26,10 @@
# @param montgomery_u [X25519::MontgomeryU] coordinate of the public key/point to perform D-H with
#
# @return [X25519::MontgomeryU] resulting point (i.e. D-H shared secret)
def diffie_hellman(montgomery_u)
raise TypeError, "expected X25519::MontgomeryU, got #{montgomery_u}" unless montgomery_u.is_a?(MontgomeryU)
+
MontgomeryU.new(X25519.diffie_hellman(@scalar_bytes, montgomery_u.to_bytes))
end
alias multiply diffie_hellman
# Fixed-base scalar multiplication. Calculates a public key from a