From 41e8984c9d5f06fc23ebeb27340dcc79592ba6fc Mon Sep 17 00:00:00 2001 From: josd Date: Tue, 14 Jan 2025 00:01:11 +0100 Subject: [PATCH] refreshing --- runs/age-zkp.pl | 18 +++++++++--------- runs/output/age-zkp.pl | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/runs/age-zkp.pl b/runs/age-zkp.pl index 37d5ea9..4a2e9c7 100644 --- a/runs/age-zkp.pl +++ b/runs/age-zkp.pl @@ -17,14 +17,14 @@ 'urn:example:age'('urn:example:simulation1', 50). % person age -'urn:example:personAge'(Simulation, Name, Age) :- +'urn:example:personAge'(Simulation, [Name, Age]) :- 'urn:example:birthDay'(Name, [Yb, Mb, Db]), 'urn:example:date'(Simulation, [Yl, Ml, Dl]), Age is Yl-Yb+(Ml-Mb)/12+(Dl-Db)/365. % prover demonstrates that persons are above some duration using a hash -'urn:example:zeroKnowledgeProof'(Simulation, Name, Result, Hash) :- - 'urn:example:personAge'(Simulation, Name, PersonAge), +'urn:example:zeroKnowledgeProof'(Simulation, [Name, Result, Hash]) :- + 'urn:example:personAge'(Simulation, [Name, PersonAge]), 'urn:example:age'(Simulation, SimulationAge), write_term_to_chars(PersonAge > SimulationAge, [], Chars), crypto_data_hash(Chars, Hash, [algorithm(sha3_512)]), @@ -34,8 +34,8 @@ ). % Challenger checking the proof using the hash -'urn:example:challengeProof'(Simulation, Name, Result, Hash) :- - 'urn:example:personAge'(Simulation, Name, PersonAge), +'urn:example:challengeProof'(Simulation, [Name, Result, Hash]) :- + 'urn:example:personAge'(Simulation, [Name, PersonAge]), 'urn:example:age'(Simulation, SimulationAge), write_term_to_chars(PersonAge > SimulationAge, [], Chars), crypto_data_hash(Chars, ProofHash, [algorithm(sha3_512)]), @@ -45,10 +45,10 @@ ). % queries -query('urn:example:zeroKnowledgeProof'('urn:example:simulation1', 'urn:example:Mary', _, _)). -query('urn:example:zeroKnowledgeProof'('urn:example:simulation1', 'urn:example:Pat', _, _)). -query('urn:example:challengeProof'('urn:example:simulation1', 'urn:example:Mary', _, "6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e821")). -query('urn:example:challengeProof'('urn:example:simulation1', 'urn:example:Pat', _, "4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8")). +query('urn:example:zeroKnowledgeProof'('urn:example:simulation1', ['urn:example:Mary', _, _])). +query('urn:example:zeroKnowledgeProof'('urn:example:simulation1', ['urn:example:Pat', _, _])). +query('urn:example:challengeProof'('urn:example:simulation1', ['urn:example:Mary', _, "6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e821"])). +query('urn:example:challengeProof'('urn:example:simulation1', ['urn:example:Pat', _, "4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8"])). run :- query(Q), diff --git a/runs/output/age-zkp.pl b/runs/output/age-zkp.pl index dd37e23..1736a4b 100644 --- a/runs/output/age-zkp.pl +++ b/runs/output/age-zkp.pl @@ -1,4 +1,4 @@ -'urn:example:zeroKnowledgeProof'('urn:example:simulation1','urn:example:Mary',"proof failed: less than 50 years and not entitled to work 80% per week","6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e822"). -'urn:example:zeroKnowledgeProof'('urn:example:simulation1','urn:example:Pat',"proof verified: more than 50 years old and entitled to work 80% per week","4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8"). -'urn:example:challengeProof'('urn:example:simulation1','urn:example:Mary',"challenge failed: the proof is invalid","6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e821"). -'urn:example:challengeProof'('urn:example:simulation1','urn:example:Pat',"challenge successful: the proof is valid","4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8"). +'urn:example:zeroKnowledgeProof'('urn:example:simulation1',['urn:example:Mary',"proof failed: less than 50 years and not entitled to work 80% per week","6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e822"]). +'urn:example:zeroKnowledgeProof'('urn:example:simulation1',['urn:example:Pat',"proof verified: more than 50 years old and entitled to work 80% per week","4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8"]). +'urn:example:challengeProof'('urn:example:simulation1',['urn:example:Mary',"challenge failed: the proof is invalid","6151e3412bc493063a9be0aadd3ecaaae9ebdca0f5d65441192fd14660f1ef91918cd29181414d8b48ade139d11d33156618878df03cdaab9e9296370b00e821"]). +'urn:example:challengeProof'('urn:example:simulation1',['urn:example:Pat',"challenge successful: the proof is valid","4ac8666fbe3e7a9206d453134ca6c38d8fa740b1e589a73c2a767c3679ac682c6e5919434a931e8b37ef62ed0ad942dab41c61e7960061dc1715bc10c0e525a8"]).