Lab41 / PySEAL

This repository is a fork of Microsoft Research's homomorphic encryption implementation, the Simple Encrypted Arithmetic Library (SEAL). This code wraps the SEAL build in a docker container and provides Python API's to the encryption library.
Other
225 stars 86 forks source link

Encode/Encrypt text message #37

Closed wake-0 closed 4 years ago

wake-0 commented 4 years ago

Hello everybody,

I wanted to encrypt a text message with PySEAL and then decrypt it. Now I noticed that there is no Encoder that uses a string as input for encoding a Plaintext object.

Is there a suitable solution for this e.g. has someone implemented an own StringEncoder?

Arman001 commented 4 years ago

I don't think there is a StringEncoder for pyseal yet. I am currently just converting string to bits and then encrypting it with simple IntegerEncoder and it works fine. If there is another way then kindly inform me.

wake-0 commented 4 years ago

@Arman001 what kind of encoding do you use for converting a string to int? Do you have any example code?

Thanks in advance!

Arman001 commented 4 years ago

@Blackjack92 may be it is naive approach but you have to convert first string to bits like below image then you can convert resulting list into a numpy array and can do bit by bit encryption and then during decryption you will get bits and you can convert back to a string using image I hope it helps.

wake-0 commented 4 years ago

@Arman001 Thank you very much for the code snippets!