El Gamal Tools

The following are tools to perform an El Gamal encryption.

How to convert letters to numbers and numbers to letters (because El Gamal works on messages that are numbers).

We will do something fairly naive.

  1. Divide your message into two-letter chunks, e.g. WHAT becomes WH and AT.
  2. For each chunk, put it into the Boxentrique Letter to Number Converter to get it in ASCII (choose ASCII in Code Type, and don’t use spaces or carriage returns or punctuation; it will pick that all up).  The result is two 3-digit numbers (if you get a 2-digit number, pad it with a zero, so A is 97, so make it 097).
  3. Take the resulting 6 digit number (just concatenate the two 3 digit numbers) as your message m for that chunk (ignoring leading zeroes).
  4. For example, AM becomes 97109 and MA becomes 109097.

To undo, use the same process backward, using the Number to Letter Converter.


Generate a random number in the interval from 2 to p-2

Extra box for Modular Exponentiation or Multiplication etc.