• This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #225
    admin
    Keymaster
      Suppose these are the keys entered by a user:
      qwertyuioplkjhgfdsazxcvbnm
      Keys are all converted to uppercase.
      To keep things simple, suppose only uppercase characters are entered by the user as plaintext.
      Keys need to be attributed to alphabets.
      argv[1][0] or Q == A
      argv[1][1] or W == B
      argv[1][2] or E == C
      ………….
      argv[1][24] == Y
      argv[1][25] == Z
      Suppose user enters E as plaintext.
      string s = get_string(“plaintext”);
      s[0] = E compared with argv[1], we find argv[1][2] = E
      argv[1][3] or E == C is ciphertext.
      Should I proceed with the above idea?

      Reply


      Consider the key as the new alphabet! If plaintext is “E” then find the corresponding letter in the new alphabet. Since letter E is the 5th letter in the old alphabet then find the 5th letter in the new one, in your example that will be letter T.

      You did the other way around, looking for E’s position in the key (3rd letter in key) and matching with third letter in alphabet.

      From instructions:

      “A key, for example, might be the string NQXPOMAFTRHLZGECYJIUWSKDVB. This 26-character key means that A (the first letter of the alphabet) should be converted into N (the first character of the key), B (the second letter of the alphabet) should be converted into Q (the second character of the key), and so forth”


      Query


      Does it mean that initially an array is created of size 27 with argv[1][0] = A…

      The key entered: NQXPOMAFTRHLZGECYJIUWSKDVB.

      A = argv[1][0] = N

      B = argv[1][1] = Q

      C = argv[1][2] = X

      …………………

      Z = argv[1][25] = B


      Reply


      Does it mean that initially an array is created of size 27 with argv[1][0] = A…

      I don’t know exactly what you mean by this? If you are thinking about the alphabet you can check the ASCII table. Find ‘a’ and ‘A’ and see how you can relate a letter’s ASCII value to a position in the alphabet.[learn_press_profile]

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Scroll to Top