0

I'm working on RSA and ElGamal encryption systems but I'm stuck. I've written those algorithms, I know how it works. How can I change 256 byte chunks of file into number from range [1, 2^2048]? Because I can't pass 256 bytes as an argument with generated public key to encrypt.

  • You understand that "numbers" in a computer are already represented as just sequences of bits right? Your message to encrypt is already in the right format - bytes. This is implementation specific - what language/library are you using? – Luke Joshua Park Feb 02 '19 at 07:18
  • Yes, I do understand that. This is something that my teacher requires - changing block of 256 bytes to numbers from that range. This is python and no libraries for encryption. – ms_heisenbug Feb 02 '19 at 07:34
  • Okay - so all the existing questions on SyackOverflow about converting bytes to an integer in Python - why don't they answer your question? – Luke Joshua Park Feb 02 '19 at 07:37
  • Do you intend to encrypt a 256 byte key with RSA? In that case you need to look-up "padding", such as PKCS1.5 or OAEP padding – gusto2 Feb 02 '19 at 14:32

0 Answers0