lib/bls/point.rb in bls12-381-0.2.0 vs lib/bls/point.rb in bls12-381-0.2.1
- old
+ new
@@ -99,11 +99,11 @@
add(other.negate)
end
alias - subtract
def multiply_unsafe(scalar)
- n = scalar.is_a?(Fq) ? scalar.value : scalar
+ n = scalar.is_a?(Field) ? scalar.value : scalar
raise PointError, 'Point#multiply: invalid scalar, expected positive integer' if n <= 0
p = zero
d = self
while n.positive?
@@ -149,10 +149,10 @@
nums
end
# Constant time multiplication. Uses wNAF.
def multiply(scalar)
- n = scalar.is_a?(Fq) ? scalar.value : scalar
+ n = scalar.is_a?(Field) ? scalar.value : scalar
raise PointError, 'Invalid scalar, expected positive integer' if n <= 0
raise PointError, "Scalar has more bits than maxBits, shouldn't happen" if n.bit_length > max_bits
wNAF(n).first
end