fn Verify(publ: PublicKey, hash: &[u8], r: BigUint, s: BigUint) -> bool {
    if Sign(publ.P) == 0 {
        return false;
    }

    if Sign(r) < 1 || r.cmp(publ.Q) >= 0 {
        return false;
    }

    if Sign(s) < 1 || s.cmp(publ.Q) >= 0 {
        return false;
    }

    let mut w: BigUint;
    w.modpow(s, publ.Q);
    if w == None {
        return false;
    }

    let mut n = publ.Q.bits();
    if n % 8 != 0 {
        return false;
    }

    let mut z: BigUint;

    let mut u1: BigUint;
    u1.Mul(z, w);
    u1.modpow(u1, publ.Q);
    let mut u2 = w.Mul(r, w);
    u2.modpow(u2, publ.Q);
    let mut v = u1.Exp(publ.G, u1, publ.P);
    u2.Exp(publ.Y, u2, publ.P);
    v.Mul(v, u2);
    v.modpow(v, publ.P);
    v.modpow(v, publ.Q);

    return v.cmp(r) == 0;
}
/// Use the public key to verify the signature in the hash r, s.
/// It reports whether the signature is valid.
Use the public key to verify the signature in the hash r, s.
It reports whether the signature is valid.
Use the public key to verify the signature in the hash r s . It reports whether the signature is valid .
fn Verify(publ: PublicKey, hash: &[u8], r: BigUint, s: BigUint) -> bool {
    if Sign(publ.P) == 0 {
        return false;
    }
    if Sign(r) < 1 || r.cmp(publ.Q) >= 0 {
        return false;
    }
    if Sign(s) < 1 || s.cmp(publ.Q) >= 0 {
        return false;
    }
    let mut w: BigUint;
    w.modpow(s, publ.Q);
    if w == None {
        return false;
    }
    let mut n = publ.Q.bits();
    if n % 8 != 0 {
        return false;
    }
    let mut z: BigUint;
    let mut u1: BigUint;
    u1.Mul(z, w);
    u1.modpow(u1, publ.Q);
    let mut u2 = w.Mul(r, w);
    u2.modpow(u2, publ.Q);
    let mut v = u1.Exp(publ.G, u1, publ.P);
    u2.Exp(publ.Y, u2, publ.P);
    v.Mul(v, u2);
    v.modpow(v, publ.P);
    v.modpow(v, publ.Q);
    return v.cmp(r) == 0;
}
fn Verify ( publ : PublicKey , hash : & [ u8 ] , r : BigUint , s : BigUint ) -> bool { if Sign ( publ . P ) == 0 { return false ; } if Sign ( r ) < 1 || r . cmp ( publ . Q ) >= 0 { return false ; } if Sign ( s ) < 1 || s . cmp ( publ . Q ) >= 0 { return false ; } let mut w : BigUint ; w . modpow ( s , publ . Q ) ; if w == None { return false ; } let mut n = publ . Q . bits ( ) ; if n % 8 != 0 { return false ; } let mut z : BigUint ; let mut u1 : BigUint ; u1 . Mul ( z , w ) ; u1 . modpow ( u1 , publ . Q ) ; let mut u2 = w . Mul ( r , w ) ; u2 . modpow ( u2 , publ . Q ) ; let mut v = u1 . Exp ( publ . G , u1 , publ . P ) ; u2 . Exp ( publ . Y , u2 , publ . P ) ; v . Mul ( v , u2 ) ; v . modpow ( v , publ . P ) ; v . modpow ( v , publ . Q ) ; return v . cmp ( r ) == 0 ; }
Use the public key to verify the signature in the hash r, s.
It reports whether the signature is valid.
Use the public key to verify the signature in the hash r s . It reports whether the signature is valid .
publ
PublicKey
hash
&[u8]
r
BigUint
s
BigUint
publ
PublicKey
hash
&[u8]
r
BigUint
s
BigUint