5 kyu
Simple Encryption #2 - Index-Difference
324 of 882user5036852
Loading description...
Fundamentals
Cryptography
Security
Strings
Arrays
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Can anybody explain me for example AsiqS%:vh how do get "G&HPsf9c?
ASiQS%:Vh First step A->0 S->18 => 0-18+77=59 That is '7' not 'G' ...
Probably deserves 4 kyu. Took me like 6x longer, than other 5 kyu katas usually take.
Fun kata
Hi, I'm trying to solve it but I failed at encrypt 'Kobayashi-Maru-Test'. I get "$-Wy,dM79H'i'o$n0C&I.ZTcMJw5vPlZc Hn!krhlaa;khV mkL:gvtP-S7Rt1Vp2RV;wV9VuhO Iz3dqb.U0w" should equal "$-Wy,dM79H'i'o$n0C&I.ZTcMJw5vPlZc Hn!krhlaa:khV mkL;gvtP-S7Rt1Vp2RV:wV9VuhO Iz3dqb.U0w" any suggestion ?
Ok, ":" and ";" was switched in region definition.
'Kobayashi-Maru-Test' is being returned as 'kobayashi-maru-Test'. Anyone else with the same bug?
fun kata!
How do you know in decrypt case where are upper chars at the beginning of the words? Maybe, after special chars such as ", -...
Very cool kata and original cipher!
It would be way easier to see the space char if
".,:;-?! '()$%&" and the '"'-char
was replaced with
".,:;-?! '()$%&" and the '"'-char
.
Not sure if this is a question because I'm stupid, or an issue because there is a bug. I'm in C# trying to throw a bog-standard exception (like we were told to do) but I just can't get the test case to pass. This is what I am doing:
throw new Exception();
but the test case keeps saying:
Test Failed Expected: <System.Exception> But was: null
I can pass out OTHER exceptions and have the test case see those, but obviously that is incorrect because it is not the correct exception. Any help here would be great
greetings,
this part where it says, (the following chars: ".,:;-?! '()$%&" and the '"'-char)....does the last part mean, " symbol as in double qoutation mark for the last char in the region of chars?
nevermind found my issue.
This comment has been hidden.
Very nice kata.. Fun to solve.. Thanks;-)
Fun kata. The wording on the explanation of the region-difference was very unclear to me. It took ages for me to figure out what was actually desired. Showing an example for the third character would be very helpful for this point.
I found an error in the testing for unallowed characters in Python, where the instructions ask to throw an "Exception" but the test is looking for "Error". Easy fix in my code, but should be corrected in either the instructions or test.
I try to throw an exception with "throw std::exception()" (or with invalid argument) like many of the solutions do, but I keep getting a message saying "No exception thrown." or "Wrong exception thrown." Could this be a bug?
same, I suppose it's a bug
This part of the description seems weird
"Take the difference from the region-index of the char before (from the input text! Not from the fresh encrypted char before!)."
This could be read as you should use the index value for the n-1, before any transforms from step 1 (so without any change in case), rather than without any of the transforms during step 2.
At the very least it should be reworded to be clearer. Also, information is brackets is usually supplemental/optional, rather than required information.
Thanks for this Kata! It was really enjoyable. But I feel so dumb everytime I see the other Solutions...
iam getting this error "terminating with unexpected exception of type std::exception*" Language used is c++
This comment has been hidden.
Spoilers...
sorry, I am a freshman in this website some rules I havn't got clearly now if I offend the regulation, I will delete the post
It should be made clear in step1 that every 2nd char is to be converted to uppercase if it's lowercase AND to lowercase if it's uppercase. The instructions just mention about uppercase.
I spent so much time debugging it and I would've given up if there wasn't a hint in this discussion chat.
Yes! Thank you, that needs to be made VERY clear in the instructions.
Thanks for you now i know the reason of the error in my code)
Hey Guys. I am trying to finish this kata with C++. I have passed all the tests except of Random Test. Please, help me. Time: 10ms Passed: 4 Failed: 1 Test Results: ExampleTest _0_EncryptTests _1_DecryptTests _2_EmptyTests ExtendedTests _0_NotAllowedCharactersTests _1_RandomTests Expected: equal to n1,2tvu$ Actual: CqarI9JKg
How can I understand the meaning of the random test?
I have found my mistake by using std::cout. I didn't know that I can use some logging to understand the tests.
It would be VERY helpful to indicate where exactly the space is within the region (finally found it hiding between the exclamation point and the apostrophe). It's almost impossible to see in the list of punctuation in the description. Honestly providing a list of all the punctuation in the proper order and just saying "copy-paste this into your code where you need to" would be great since that's not really part of the coding challenge.
Also please consider extending your example of "Business" to show encryption for the first 3 letters, since the encryption process is slightly different for the first "s".
could someone please direct me to a resource explaining what is meant by "region" in this context?? I am not familiar with the term. Thank you!
Ok I figured it out!! Apparently region means "all the characters that are valid in this exercise, in a particular order." So for this exercise capital letters, lower-case letters, digits, some punctuation, and SPACES are in the "region".
I'm having trouble finishing this Kata in c++. Everything seems to be working appropriately (all tests are successful), but there seems to be something within the _0_NotAllowedCharactersTests Extended Tests that's not allowing me to fully submit my solution. I know that there are some prechecks in the instructions, but nothing for c++, yet I think I've narrowed down the error to not having thrown an exception whenever there's an invalid character. I can't seem to do this correctly, given that I get either a SIGABRT or SIGSEGV signal. Any thoughts? Thank you so much!
As you can see, 64 peolpe did this kata in C++ without any problems. So I think, there is no issue in the kata, but maybe in your code.
Maybe post your code here (mark as spoiler) and then we will see. :-)
This comment has been hidden.
can you write the rest of the example with "Business" I get how to create the region with all 77 chars, and step 1 and as well step 3. but for some reason I am messing up on step 2. can you write the rest of the example for step 2 please for the string "Business".
I am quite new to Python and this was a nice challenge to learn a lot about Python. The detailed steps made it understandable even for a non-english speaker. Fabulous task!
The detailed descriptions helped a lot, especially these stages. Thanks a lot, it was great.
I'm glad you like it! :-)
Nice kata! Thank you.
I have only a small suggestion: do not use the "from the input text!" expression in the second step of the algorithm, because one has to use the case modified text.
This comment has been hidden.
I dod not see you code.
But it is exactly the same result like oxxidQ has gotten.
So I think: Your Problem is, that you take every 2nd char to Upper. But this is not, what is said in the description. There it is said: "For every second char do a switch of the case." That means: Lower -> Upper and Upper -> Lower!
Then it would be-> "DO ThE KaTa "k..." instead of "DO ThE KaTa "K..."
Thanks, I misread that part. After fixing it my solution finally passes. Much appreciated, SteffenVogel.
Great! :-)
Hello,
I have problem passing first assert in the test EncryptExampleTests. This is the test output:
String lengths are both 86. Strings differ at index 13.
Expected: "$-Wy,dM79H'i'o$n0C&I.ZTcMJw5vPlZc Hn!krhlaa:khV mkL;gvtP-S7Rt..."
But was__:"$-Wy,dM79H'i'-vn0C&I.ZT2,Jw5vPlZc H;qkrhlaa:khV mkL;gvtP-S7Rt..."
------------------------^
The " character seems to be causing the issue. Can anybody here give me a hand here? All other test pass sucessfully.Thank you
Hi! Which language? C#? There are more differences. At index 13 is only the first difference. Do you have the "-sign in your region?
Maybe past your code here (mark as spoiler!).
The DecryptExampleTests work without problems?
This comment has been hidden.
This comment has been hidden.
I appear to be having the same issue (as commented elsewhere in this discussion forum). Did you get the issue resolved with the kata author?
Did you read my answer above?
Your Problem is, that you take every 2nd char to Upper. But this is not, what is said in the description. There it is said: "For every second char do a switch of the case." That means: Lower -> Upper and Upper -> Lower!
With that modification your solution works!
(But instead of -= 77 you should generally use the %-Operator.)
I am able to pass all tests except the ExtendedTests: _0_NotAllowedCharactersTests. I tried throwing an exception for characters not found in the region, but when '#' occurs in the text to encrypt I still get the message: ✘ Expected std::exception. No exception was thrown.
I could post some portion of my code here, but I am not sure what the rules are about doing so.
Thank you for any hints that you could give me.
Post your code here and mark it as spoiler. :-)
I have the very same problem. Did you happen to find out what we are supposed to throw?
Turns out you have to check for non-legal characters when you encrypt AND also when you decrypt
C++-Translation kumited!
Please check it and approve! Thanks. (:
Approved! Thanks a lot! You are the hero of the cpp-Warriors!
Perhaps Mr. CPP himself could translate the following kata to C# ?? :-) https://www.codewars.com/kata/579fc79b53ba33b408000c80
Probably not the best place to tell this, but for lack of better alternatives, let's go with it anyway: I will be in Berlin for a few weeks, if this can be of interest to any of you.
[I will remove the post in a short while, after you have read it]
@SteffenVogel
,Python translation kumited!
I also made a few changes to the description to (hopefully) make it more readable. If you have any questions, just let me know!
EDIT:
Just so you know, I tested the Python translation using both Python 2 and Python 3.
I rejected some changes of the descripion, and some other very good changes are approved.
And the translation is approved! Very good work.
No problem, it's your kata after all!
After seeing which changes you liked/disliked, I will try to keep that in mind for any future translations.
I enjoy your katas, keep up the great work!
In the next days I will translate the first Encryption kata to JS. ;-)
What about your ideas for new katas?
I'm running into duplicates for some of the ideas I've had for new katas. I'm working on one right now that I can't seem to find any duplicates for. Hopefully I'll have it done by tonight.
There it is:
https://www.codewars.com/kata/57814d79a56c88e3e0000786
In JS! ;-)
@Zebulan: What about new katas?? :-)
Sorry for the delay, busy day;-)... Again good kata, thanks:-)!
I was already wondering, where you are.... :D ;-) But it is good to know, that also "Mr. Turbo-Coder" is sometimes busy... :-)
Surely:-)... I'm always busy, so solving by the way:-)... Sometimes it's visible, hope not very often;-) And there are many katas waiting for a solution, my list gets longer and longer:-)...
By the way, where do you come from or what time is it at your location? I think i'm some hours in front of you, but don't know...?
I'am from Germany, too. So i think you are only in progressing/solving katas some hours in front of me. :D
Ah, ok... und welcher Ort oder Region (bei mir zwischen Köln/Düsseldorf);-)? Dachte mir das auch zuerst, der Name spricht eigentlich dafür, aber irgendwie war ich der Meinung, dass die Zeiten nicht so ganz passen und "CSV-SLayer" sagt mir auch nichts, lag ich wohl falsch:-)...
Region Berlin-Brandenburg. Ja, mein Name klingt schon recht deutsch. :D Programmierer sind doch eh zeitlose Wesen! ;-)
Naja, meiner ja auch;-)! Na dann erstmal noch 'nen schönen Abend und sicher bis zum nächsten Kata;-)...
Gleichfalls!
Eine Frage noch: Können Translations nur vom Autor der eigentlichen Kata approved werden? Oder von jedem "Admin"?
Nur vom Autor, macht auch Sinn, finde ich... Hab die Anmerkungen gelesen, konnte aber nicht darauf antworten, da die "Links" in dem Falle nicht anklickbar sind. Admin? Du meinst User mit mehr als 3000 Punkten (glaube die "letzte Stufe" sind 3000 Punkte, weiß es nicht mehr so genau), daher kann ich auch Katas editieren und Fehler beheben. Ob es darüber hinaus noch "User" (spezielle Admin?) für bestimmte andere Dinge gibt, ist mir nicht bekannt. Hab' mich nie so um die Details hier gekümmert, bin auch noch nicht sooo lange hier;-)...