Skip to content
TheChatArchiveThe Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)Hugging Face OpenAssistant Conversations (oasst2)

While performing the hill cipher 2x2 (using mod 26), I'm having a bit of trouble…

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    While performing the hill cipher 2x2 (using mod 26), I'm having a bit of trouble determining what my final determinant should look like, because it's hard for me to find a number that I can multiply by my determinant to get 1 mod 26.

  2. Assistant

    For a 2x2 Hill cipher, your determinant should be relatively prime to 26 (have a gcd of 1). Some options would be:

    3 (3 * 9 = 1 mod 26) 5 (5 * 5 = 1 mod 26) 7 (7 * 7 = 1 mod 26) 9 (9 * 3 = 1 mod 26)

    So you could use:

    [3, 5] [7, 9]

    etc.

    In general, you want to pick two numbers a and b where gcd(a, 26) = gcd(b, 26) = 1, and then your determinant will be a * b % 26, which will be 1. So just pick two numbers relatively prime to 26 and multiply them, taking the result modulo 26. That will give you a valid determinant for a 2x2 Hill cipher mod 26.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.