Points provide the interface to NaCl's Curve25519 high-speed elliptic curve cryptography, which can be used for implementing Diffie-Hellman and other forms of public key cryptography (e.g. RbNaCl::Box)
Objects of the Point class represent points on Edwards curves. NaCl defines a base point (the "standard group element") which we can multiply by an arbitrary integer. This is how NaCl computes public keys from private keys.
Constant Summary collapseNaCl's Curve25519 base point (a.k.a. standard group element), serialized as hex
["0900000000000000000000000000000000000000000000000000000000000000"].pack("H*").freeze
Order of the standard group
2**252 + 27_742_317_777_372_353_535_851_937_790_883_648_493
Degenerate key (all-zeroes, results in an all-zero shared secret)
"\0" * 32
Number of bytes in a scalar on this curve
32
32
Returns the value of attribute base_point.
NaCl's standard base point for all Curve25519 public keys.
Creates a new Point from the given serialization.
Multiply the given integer by this point This ordering is a bit confusing because traditionally the point would be the right-hand operand.
Return the point serialized as bytes.
primitive, sodium_constant, sodium_function, sodium_function_with_return_code, sodium_primitive, sodium_type
Methods included from Serializable Methods included from KeyComparator Constructor Details #initialize(point) ⇒ RbNaCl::PointCreates a new Point from the given serialization
47 48 49 50 51 52 53 54 55
# File 'lib/rbnacl/group_elements/curve25519.rb', line 47 def initialize(point) @point = point.to_str raise CryptoError, "degenerate key detected" if @point == DEGENERATE_KEY Util.check_length(@point, SCALARBYTES, "group element") endClass Attribute Details .base_point ⇒ Object
Returns the value of attribute base_point.
92 93 94
# File 'lib/rbnacl/group_elements/curve25519.rb', line 92 def base_point @base_point endClass Method Details .base ⇒ RbNaCl::Point
NaCl's standard base point for all Curve25519 public keys
87 88 89 90
# File 'lib/rbnacl/group_elements/curve25519.rb', line 87 def self.base @base_point endInstance Method Details #mult(integer) ⇒ RbNaCl::Point
Multiply the given integer by this point This ordering is a bit confusing because traditionally the point would be the right-hand operand.
64 65 66 67 68 69 70 71 72 73
# File 'lib/rbnacl/group_elements/curve25519.rb', line 64 def mult(integer) integer = integer.to_str Util.check_length(integer, SCALARBYTES, "integer") result = Util.zeros(SCALARBYTES) raise CryptoError, "degenerate key detected" unless self.class.scalarmult_curve25519(result, integer, @point) self.class.new(result) end#to_bytes ⇒ String
Return the point serialized as bytes
78 79 80
# File 'lib/rbnacl/group_elements/curve25519.rb', line 78 def to_bytes @point end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4