lib/nis/util/ed25519.rb
# Not safe to use when any argument is secret.
# This function should be used only for
# verifying public signatures of public messages.
Not safe to use when any argument is secret.
This function should be used only for
verifying public signatures of public messages.
Not safe to use when any argument is secret . This function should be used only for verifying public signatures of public messages .
def checkvalid(s, m, pk)
        raise 'signature length is wrong' if s.size != @@b / 4
        raise 'public-key length is wrong' if pk.size != @@b / 8
        _R = decodepoint(s[0...@@b / 8])
        _A = decodepoint(pk)
        _S = decodeint(s[@@b / 8...@@b / 4])
        h = Hint(encodepoint(_R) + pk + m)
        x1, y1, z1, _t1 = _P = scalarmult_B(_S)
        x2, y2, z2, _t2 = _Q = edwards_add(_R, scalarmult(_A, h))
        if (!isoncurve(_P) || !isoncurve(_Q) || (x1 * z2 - x2 * z1) % q != 0 || (y1 * z2 - y2 * z1) % q != 0)
          raise SignatureMismatch('signature does not pass verification')
        end
      end
def checkvalid ( s , m , pk ) raise 'signature length is wrong' if s . size != @@b / 4 raise 'public-key length is wrong' if pk . size != @@b / 8 _R = decodepoint ( s [ 0 ... @@b / 8 ] ) _A = decodepoint ( pk ) _S = decodeint ( s [ @@b / 8 ... @@b / 4 ] ) h = Hint ( encodepoint ( _R ) + pk + m ) x1 , y1 , z1 , _t1 = _P = scalarmult_B ( _S ) x2 , y2 , z2 , _t2 = _Q = edwards_add ( _R , scalarmult ( _A , h ) ) if ( ! isoncurve ( _P ) || ! isoncurve ( _Q ) || ( x1 * z2 - x2 * z1 ) % q != 0 || ( y1 * z2 - y2 * z1 ) % q != 0 ) raise SignatureMismatch ( 'signature does not pass verification' ) end end
Not safe to use when any argument is secret.
Not safe to use when any argument is secret .
s
<not_specific>
m
<not_specific>
pk
<not_specific>