Draft

Encrypt the message!

Description
Loading description...
  • Please sign in or sign up to leave a comment.
  • kwekuasiedu315 Avatar

    This comment has been hidden.

    • Chrono79 Avatar

      Please don't post solutions in Discourse. It means you can make changes (if you want) to your code before submitting it. After that, that's the solution it'll show no matter how many times you submit another version. Note this kata is a Draft, so you can't submit your solution.

    • kwekuasiedu315 Avatar

      Thanks for your help. I posted my solution because no one didn't comment on my first comment.

  • kwekuasiedu315 Avatar

    I have solved it and passes all test but i don't know why I can't sbmit my solution.

  • ejini战神 Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    A lossy encryption algorithm ?!?

    With key "hi", given the ciphertext, you can't know if the first character of the plaintext is 'H' or 'I'.

    As an author, you have a lot of leeway in designing your kata, but this is ridiculous.

    Note: If the process is done but the other characters in the password are not used, encrypt the remaining characters in the password by adding its index and its ascii decimal then add 40 and divide it by 2 and convert the result into a character. Ex. ((index+decimal)+40)/2. Concatenate it to the first encrypted string.

    Given a key and a ciphertext, how will you know where the plaintext ends and the trailing garbage begins? Trailing garbage might look like perfectly valid plaintext ( for medium high indices, you'll get digits ).

    It is even possible to run out of ASCII for longer key values ( note that standard ASCII only goes up to 127 ).

    Please don't make any contributions to OpenSSL just yet. :S

    • centavosx Avatar

      I'm very thankful for this comment, what I wanted to is to create a very simple encryption but I was wrong for adding the index in a computation. Thank you, I'll fix this.

    • anter69 Avatar

      A lossy encryption algorithm ?!?

      Treat it as a hash function :-)

    • JohanWiltink Avatar

      Treat it as a [ bad ] hash function :-)

      FIFY :P

      @author: maybe you could lower the expectations somewhat by using the word "hashing" or "encoding" instead of "encryption". Encryption just is never simple. You might have kept the use of an index by using a modulo; you might have used an xor instead of a division ( or instead of an average ) to keep things more cryptographically sound, but if you want to keep things simple, invoking cryptography is not the way to do it.

      You are free to design your kata any way you like, but set the scene appropriately. :]

    • centavosx Avatar

      Okay sir, thanks for the advice.

  • mauro-1 Avatar

    If the password is longer than the message, encrypt the remaining index in the password by adding the index and the decimal of the character and add 40 then divide it by 2 and convert the result to a character. Ex. ((index+decimal)+40)/2.

    This part makes no sense. It's easier to guess the algorithm from tests than to decipher the description.

    • centavosx Avatar

      Yeah I know, I'm pretty bad at english but I want to author a problem so I'll thank you for that. I'll fix the grammar soon.

  • FArekkusu Avatar

    The handling of messages shorter than keys is explained terribly. Why does key length affect encryption in such a dumb way in the first place?

    • centavosx Avatar

      It is my bad, what I'm trying to say is the remaining characters that are not used. Thank you again for that.

  • FArekkusu Avatar

    get the decimal of a character

    There's no such thing as "decimal of a characater".

    If the answer is not a whole number, only get the whole number

    How?

    • centavosx Avatar

      What i'm trying to say is the ascii decimal of a character in ascii list. For "If the answer is not a whole number, only get the whole number", example: 5.6 => 6, I forgot the term that's why I can't explain it properly. But thanks for that, I'll fix it.

  • mauro-1 Avatar

    "decimal of a character" -> "ascii code"