Code Monkey home page Code Monkey logo

Comments (30)

ladnir avatar ladnir commented on July 25, 2024

See the message passing example. You can put the messages in a file, as the examples shows. Then it's up to you to send them.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I know this example. But isn 't there a bug in this example as https://github.com/Visa-Research/volepsi/issues/15

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

It might be a bug with the example as opposed to the actual library. Not sure. Also, I'll be fixing it next week so should be fine to assume that it works and wait for the fix.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

Okey, I see what your mean. Thanks

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I have some problems about the message passing example. Why does the example need to loop reading and writing file when the protocol.is_ready() == false ? And why does each party produce three files(0,1,2) in this process?

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

In the message passing example, receiver write information, sender can read correctly. But sender write file, receiver can't read correctly. Another issue is that who first write file have some effect?

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

That example shows how to generically execute any protocol. They send messages back and forth. The number of rounds is some constant. So I guess its 3 in this case?

Yeah, i suspect there is some bug in the example code. Still haven't had time to debug it. The main idea is that you need to pass the outbound message to the other other party who uses it as an inbound message.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I can't understant some code in messagePassingExample.h as follow:
// The sender we generate the first message. if (!sender) write(); // While the protocol is not done we alternate between reading and writing messages. while (protocol.is_ready() == false) { read(); write(); }

that part result 3 file for each party

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

The example code has been fixed. See the other thread for details. But the change also increased the number of messages from 3 to 6. With time ill get 3 messages working again.

The protocol looks like

Sender               Receiver
        <------------   mr_0
ms_0 -------------> 
        <------------   mr_1
ms_1 -------------> 
...

        <------------   mr_n
ms_n -------------> 

mr_i is computed using the receiver's internal state and the sender's msg ms_{i-1} (if one exists). ms_i is computed using the sender's internal state and the receiver's msg mr_i.

protocol.is_ready() returns true if the protocol is done. If its not done, then that means you need to read the incoming message i.e. call read() and generate an outgoing message, i.e. call write().

Im not sure how to be more clear. Maybe you can explain whats confusing.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I have copy the file "RsPsi.cpp", "messagePassingExample.h"and "networkSocketExample.h". And used make to compile project. When i using ./frontend -messagePass, it can't end properly, only show sender done. Is it a bug?

And the message mr_1 and mr_2 written by receiver is inconsistent with the message read by sender.

I want to know about more detail about generate the message? Do you have some suggestation? thanks

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

if you have your own copy make sure the last param to init(...) is false. Otherwise the intersection is always empty.

https://github.com/Visa-Research/volepsi/blob/main/frontend/messagePassingExample.h#L176

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

If that doenst fix your issue then try ./frontend -messagePass -v and show the output.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I am sure the last param to init(...) is false. When i try ./frontend -messagePass -v and the output as follow

recver start
sender start
sender write 0 e68eb4e4ce6f89169220130a96df816c
sender file renamed successfully
recver read 0 e68eb4e4ce6f89169220130a96df816c
recver write 0 064d82349ace9b3218434d4a353678d7
recver file renamed successfully
recver read 1 4f738545cd9e0e69f9287a218daf31aa
recver write 1 93cee510e3acf452ba764321784be96f
recver file renamed successfully
sender read 0 064d82349ace9b3218434d4a353678d7
sender write 1 0b1ff0a15fd677beea843b60fa9f489b
sender file renamed successfully
sender read 1 93cee510e3acf452ba764321784be96f
sender write 2 c71d71a77e51ad20c7ca98376e8c3001
sender file renamed successfully
recver read 2 c71d71a77e51ad20c7ca98376e8c3001
recver write 2 f2e9d74c0bf115546b33335e575ec3c3
recver file renamed successfully
sender read 2 f2e9d74c0bf115546b33335e575ec3c3
sender done

Note that this does not end, just stay here

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

And what happens when you run the unit tests frontend -u

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

The last output as follow

=============================================
All Passed (46)
=============================================
WARNING: This program made use of the LPN silver encoder. This encoder is experimental and should not be used in production. Rebuild libOTe with -DNO_SILVER_WARNING=TRUE to disable this message or build the library with -DENABLE_BITPOLYMUL=TRUE to use an encoding with provable minimum distance. /home/cc/VOLE/volepsi-main/out/libOTe/libOTe/TwoChooseOne/Silent/SilentOtExtSender.cpp:60

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

When you run the example does the program finish or hang

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

Have you modified the example at all?

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

when use ./frontend -messagePass , the program was hang. And finished when use frontend -u.

I just copy the content of last file messagePassingexample.h, RsPsi.cpp, and networkSocketExample

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

try this example:

void messagePassingExampleBoth(oc::CLP& cmd)
{
    // The sender set size.
    auto ns = cmd.getOr("senderSize", 100);

    // The receiver set size.
    auto nr = cmd.getOr("receiverSize", 100);
    auto verbose = cmd.isSet("v");

    // The statistical security parameter.
    auto ssp = cmd.getOr("ssp", 40);

    // Malicious Security.
    auto mal = cmd.isSet("malicious");

    // The vole type.
#ifdef ENABLE_BITPOLYMUL
    auto type = cmd.isSet("useSilver") ? oc::MultType::slv5 : oc::MultType::QuasiCyclic;
#else
    auto type = oc::MultType::slv5;
#endif

    // A buffering socket. This socket type internally buffers the 
    // protocol messages. It is then up to the user to manually send
    // and receive messages via the getOutbond(...) and processInbount(...)
    // methods.
    coproto::BufferingSocket senderSock, recverSock;

    // Sets are always represented as 16 byte values. To support longer elements one can hash them.
    std::vector<oc::block> senderSet, recverSet;
    volePSI::RsPsiSender sender;
    senderSet.resize(ns);

    // in this example we use the set {0,1,...}.
    for (oc::u64 i = 0; i < ns; ++i)
        senderSet[i] = oc::block(0, i);

    sender.setMultType(type);
    sender.init(ns, nr, ssp, oc::sysRandomSeed(), mal, 1, false);

    if (verbose)
        std::cout << "sender start\n";

    // Eagerly start the protocol. This will run the protocol up to the point
    // that it need to receive a message from the other party.
    coproto::optional<macoro::eager_task<>> senderProto =
        sender.run(senderSet, senderSock) | macoro::make_eager();


    // in this example we use the set {0,1,...}.
    recverSet.resize(nr);
    for (oc::u64 i = 0; i < nr; ++i)
        recverSet[i] = oc::block(0, i);

    volePSI::RsPsiReceiver recevier;
    recevier.setMultType(type);
    recevier.init(ns, nr, ssp, oc::sysRandomSeed(), mal, 1, false);

    if (verbose)
        std::cout << "recver start\n";


    // Eagerly start the protocol. This will run the protocol up to the point
    // that it need to receive a message from the other party.
    coproto::optional<macoro::eager_task<>> recverProto =
        recevier.run(recverSet, recverSock) | macoro::make_eager();
    try
    {
        while (recverProto || senderProto)
        {
            if (recverProto && recverProto->is_ready())
            {
                coproto::sync_wait(*recverProto);
                std::cout << "recver done " << recevier.mIntersection.size() << " \n";
                recverProto.reset();
            }

            if (senderProto && senderProto->is_ready())
            {
                coproto::sync_wait(*senderProto);
                std::cout << "sender done " << " \n";
                senderProto.reset();
            }
            auto recverMsg = recverSock.getOutbound();
            if (recverMsg.has_value())
                senderSock.processInbound(*recverMsg);

            auto senderMsg = senderSock.getOutbound();
            if (senderMsg)
                recverSock.processInbound(*senderMsg);
        }

    }
    catch (std::exception& e)
    {
        std::cout << "Exception: " << e.what() << std::endl;
    }


}

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

I use the function messagePassingExampleBoth to replace the messagePassingExanple, but can't compile. It show:

/home/cc/VOLE/volepsi-main/frontend/messagePassingExample.h:196:52: error: cannot convert ‘std::remove_reference<std::vector&>::type’ {aka ‘std::vector’} to ‘coproto::span’ {aka ‘nonstd::span_lite::span<unsigned char, 18446744073709551615>’}
196 | senderSock.processInbound(std::move(*recverMsg));
| ~~~~~~~~~^~~~~~~~~~~~
| |
| std::remove_reference<std::vector&>::type {aka std::vector}
compilation terminated due to -Wfatal-errors.

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

I updated the code above. Try again

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

#17 (comment)

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

OK, I update the code. It is successed.
The output when i use the command ./frontend -messagePassing

recver done 100
sender done
recver done 100
sender done

The output when i use the command ./frontend -messagePassing -v

sender start
sender start
recver start
recver start
recver done 100
sender done
recver done 100
sender done

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

great. All good?

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

Also fixed the previous issue with using fewer rounds. See this options https://github.com/Visa-Research/volepsi/blob/main/frontend/messagePassingExample.h#L136

When set, the protocol does a bit more work but required fewer messages to be sent.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

Well, I 've updated all the files you 've updated, and re-compile the project. But the function messagePassingExampleRun in file messagePassingExample.h still can't to work properly. The function messagePassingExampleBoth can work , but it can't generate the message file.

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

Write the message file yourself. Seems like a simple task. Use messagePassingExampleBoth as a starting point. You have a vector of bytes. Write them to a file or send them however you want.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

Indeed, I can imitate the function communicate.

The last question, I want to know more details about the message to be transmitted. How to generate,and what is it related to?

Thank you very much. It 's too much trouble.

from volepsi.

ladnir avatar ladnir commented on July 25, 2024

Well you can read the papers linked in the Readme. If you used the reduced round setting, then the first messages are the base ots. This consist a one message from each party. These are then used to construct the vole by send one more message. The receiver encodes their set and sends it to the sender. Finally the sender encodes their set using the vole and sends it to the receiver.

from volepsi.

TY-cc avatar TY-cc commented on July 25, 2024

Thank for your help. Your description is very clear.
Thanks again.

from volepsi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.