• 0 Posts
  • 2 Comments
Joined 11 months ago
cake
Cake day: October 25th, 2023

help-circle

  • The file you posted worked for me. So it must have gotten there as you were trying to fetch it.

    I got,

    import "hashes/sha256/512bitPadded.code" as sha256;
    from "ecc/babyjubjubParams" import BabyJubJubParams;
    import "signatures/verifyEddsa.code" as verifyEddsa;
    import "ecc/babyjubjubParams.code" as context;
    
    def main(u32 min, u32 max, u32 [8] attr, private u32 [8] vc, private field[2] R, private field S, field[2] A, u32[8] M0, u32[8] M1) -> bool{
        //Verify Signature (R,S) with PupKey (A) on Hash (M0, M1)
    	BabyJubJubParams context = context();
        bool isVerified = verifyEddsa(R, S, A, M0, M1, context);
        u32[8] hash1 = sha256(attr, vc);
        // M0 is the first 32 bytes of sha256(input 1 || vc) || sha256(attr || vc)
        bool hashcheck = hash1 == M0;
    
        bool rangeCheck = vc[7] >= min && vc[7] <= max;
    
        bool r = isVerified && hashcheck && rangeCheck;
    
        return r;