Giter Club home page Giter Club logo

Comments (8)

KyoohyungHan avatar KyoohyungHan commented on May 30, 2024

Hi siaaron045

I tested as the following command.

// Encrypt mvec
Ciphertext cipher = scheme.encrypt(mvec, slots, L);

// Multiple negative value (= -0.1)
Ciphertext cmultCipher = scheme.multByConst(cipher, -0.1);
scheme.reScaleByAndEqual(cmultCipher, 1);

I checked the decrypted result. And It seems correct.
It would be better if you can attach some part of your code.

Best, Kyoohyung Han

from fullrns-heaan.

siaaron045 avatar siaaron045 commented on May 30, 2024

I test your code and the answer is right,
but when ''cipher'' is a negative number's ciphertext or make multiplication of two negative ciphertext,the answer is wrong.
like this:
//Encrypt mvec=-5 Ciphertext cipher1 = scheme.encrypt(mvec, slots, L); Ciphertext cipher2=cipher1; Ciphertext cmultCipher = scheme.multByConst(cipher1, -1); //or Ciphertext cmultCipher = scheme.mult(cipher1, cipher2); scheme.reScaleByAndEqual(cmultCipher, 1);
both of the answers are wrong.
So the encrypted number can't be negative?

from fullrns-heaan.

KyoohyungHan avatar KyoohyungHan commented on May 30, 2024

Oh... when I put -1 instead of -5 it works.

This problem came from the negate function in Context.cpp.
I will fix this problem soon.

Thanks for the report.

from fullrns-heaan.

siaaron045 avatar siaaron045 commented on May 30, 2024

Yes,but it works only when mvec=-1, i put -2,-3,-4 the answers are wrong.
And the function scheme.mult(cipher1, cipher2) does not work when make multiplication of two negative ciphertext expect -1.
Thanks.

from fullrns-heaan.

siaaron045 avatar siaaron045 commented on May 30, 2024

The error still exist.
I hope you can take some time to fix it.
Thank you.

from fullrns-heaan.

pdroalves avatar pdroalves commented on May 30, 2024

@KyoohyungHan Looks like you found the error source. Can you be more specific where is it? I think I can submit a patch.

from fullrns-heaan.

Cmiiii avatar Cmiiii commented on May 30, 2024

The error still exist. I hope you can take some time to fix it. Thank you.

Hi~ is this problem solved? I found the same error too,but i have no idea how to fix it?Where exactly does this problem occur?

from fullrns-heaan.

czh-rot avatar czh-rot commented on May 30, 2024

This problem is not because of the negate function, but because of a problem with encode, where for copying simply adding the modulus leads to an encoding error. You can fix it by referring to the encoding functions of OPENFHE or Lattigo.

from fullrns-heaan.

Related Issues (5)

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.