~~~~~ [MID LEVEL] CHALLENGE ~~~~ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

~~~~~ [MID LEVEL] CHALLENGE ~~~~

Write a code that transform a text into numbers. It seems simple, but the code also should transform the numbers to original text. ::: Example ::: input: I have got output: 426833745 or 42 6833 745 input: 426833745 or 42 6833 745 (depending what you have decide before) output: I have got RULES: ● Especial characters don't need be coded, unless you find it is easy. By now, just convert texts is enough. ● This codes can be separated. One from numbers to text and other from text t numbers.

25th Oct 2017, 2:26 AM
▲TopGun ▲
▲TopGun ▲ - avatar
7 Answers
+ 4
A cipher is just another word for an algoritm we use for both encrypting and decrypting the same message. For example, if we matched every letter in the alphabet to a number (with a being 1 and z being 26), then that method we used to turn our clear text (unencrypted message) into encrypted text is our cipher. Having your program read every two numerals per character is one way to easily encrypt a message on this case. 'hello' would become '0805121215'. That's probably the simplest cipher there is.
25th Oct 2017, 2:46 AM
Christian Barraza
Christian Barraza - avatar
+ 3
@Gordie Nice! I was just about to suggest a hex or Base32 cipher, weirdly enough. So a VERY simple way of managing spaces, extra characters, while keeping the encrypted text short would be using HEX Values or extended Hex. So, while 'a' would still be 01, 'j' could be 0A, and 'z' could be 1A. Or z could simply be 'q' in a Base32 system (I believe). Adding random math to this algorithm could make the cipher a little more secure, and so on. If you don't understand what we mean by Base16 or Base32, know that our regular number system goes by a Base10 system (I would search a YouTube video about it before I try to explain it here. That's a lot to type on my phone).
25th Oct 2017, 3:14 AM
Christian Barraza
Christian Barraza - avatar
+ 2
So you're asking for us to create some sort of custom encryption algorithm that can both encrypt and decrypt using our own custom cipher?
25th Oct 2017, 2:30 AM
Christian Barraza
Christian Barraza - avatar
+ 2
Yeah please explain further
25th Oct 2017, 2:31 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
What's a cipher ?
25th Oct 2017, 2:31 AM
▲TopGun ▲
▲TopGun ▲ - avatar
+ 1
I was answering someone here, and was wondering that this challenge is a good problem to solve. Because we have 10 algarisms but 26 letters. So we must combine numbers to identify each letters or combinations of lettters. This is hard to do ! I'm still thinking how can I do it ?!
25th Oct 2017, 2:33 AM
▲TopGun ▲
▲TopGun ▲ - avatar
+ 1
I agree with you.. with two algarisms we have 100 different combinations. It's more than sufficient. But how could we solve the space problems ? Should the code be like this: 3204 87324 8893247 8 79328 ? I'm wondering now .. Google Shortner Links use something similar to that, right ?
25th Oct 2017, 3:00 AM
▲TopGun ▲
▲TopGun ▲ - avatar