I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

User talk:Mr Solo

From Rosetta Code

suggestion to a new task: message decoder[edit]

Suggestion for a New Task[edit]

i would like to suggest a new task that has the temporary name "Message Decoder"

the task is simple make an encrypted message and "hard code" it into the code and then code an encoder to display the encoded message...

the message can be anything - like each programming language can have a different message to display... or we could supply a generic message to encode - decode...

also there will be a choice for the contributors whether to show each secret message or leave it secret so the only way to read it is to run the code in that specific language...

here is an example in FreeBASIC

header|FreeBASIC[edit]

 
SCREEN 19
 
Const string1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Const string2 = "VsciBjedgrzyHalvXZKtUPumGfIwJxqOCFRApnDhQWobLkESYMTN"
 
REDIM AS STRING message(0)
DIM AS STRING r
 
SUB sAppend(arr() AS STRING , Item AS STRING)
REDIM PRESERVE arr(LBOUND(arr) TO UBOUND(arr) + 1) AS STRING
arr(UBOUND(arr)) = Item
END SUB
 
FOR i AS INTEGER = 0 TO 27
READ r
SAPPEND(message(), r)
NEXT
 
SUB encode_decode(arr() AS STRING)
Dim s As String
Dim p As INTEGER
Dim As String vector, key
 
vector = string2 : key = string1
DIM currentChar AS INTEGER
FOR i AS INTEGER = 0 TO UBOUND(arr)
FOR x AS INTEGER = 1 TO LEN(arr(i))
currentChar = ASC(MID(arr(i), x, 1))
 
IF (currentChar >= 65 AND currentChar <= 90) OR (currentChar >= 97 AND currentChar <= 122) THEN
p = INSTR(vector, MID(arr(i), x, 1))
MID(arr(i), x, 1) = MID(key, p, 1)
END IF
 
NEXT
 
NEXT
 
FOR i AS INTEGER = 0 TO UBOUND(arr)
PRINT arr(i)
NEXT
 
 
END SUB
 
encode_decode(message())
 
 
 
SLEEP
 
 
 
 
DATA "kqLkRhC kqLkRhC Qhq kYQ kFbqq OQEb"
DATA "kFRL RL Ih qhJQxqx kqMk DqLLICq OQb kqLkRhC kFq qhJQxqb xqJQxqb JQxq"
DATA "Qhq WnEL Qhq RL kYQ kqh DEnkRWnT wT kqh RL Qhq FEhxbqx..."
DATA" R FQWq R xQh'k FISq LWqnnRhC DRLkIpqL..."
DATA "kQxIT YIL I wqIEkROEn xIT YRkF YIbD YqIkFqb Ihx LEhhT LpT"
DATA "Rk'L ORSq OQEb-kFT qRCFk WD Fqbq Ihx kFq LEh AELk Lqk"
DATA "YFQqSqb TQE Ibq Ihx YFIk qSqb TQEb xQRhC R FQWq Ihx YRLF TQE Yqnn"
DATA "DIT Yq Inn JQhkRhEq kQ nqIbh Ihx WbQCbqLL Rh QEb YIT Rh nROq"
DATA "DIT Yq Inn nqIbh kQ wq wqkkqb JQxqbL Ihx WbQCbIDDqbL Rh YFIkqSqb"
DATA "WbQCbIDDRhC nIhCEICq Yq JFQQLq kQ nqIbh... DIT kFq js JQDDEhRkT"
DATA "LFqnn JQhkRhEq kQ qSQnSq Ihx LkIT bqnqSIhk Rh kFq WbQCbIDDRhC nIhCEICqL"
DATA "R LkRnn JQxq Rh js IL Yqnn QkFqb nIhCEICqL Ihx qSqbTxIT R nqIbh LQDqkFRhC hqY"
DATA "qSqbTxIT R JQxq LQDqkFRhC hqY Qb YQbp Qh LQDqkFRhC Rh JQxq"
DATA "JQxRhC RL Ih qMJqnnqhk YIT kQ OQbCqk kbQEwnqL Ihx YQbbRqL QO qSqbT xIT'L nROq"
DATA "R FQWq LQDqxIT kFq JQbQhI Qb JQSRx WIhxqDRJ YRnn wq wqFRhx EL Inn"
DATA "kRnn kFqh R FQWq Yq Inn LkIT FqInkFT LIOq Ihx WbQkqJkqx..."
DATA "Ihx LkIT Rh kQEJF YRkF QEb nQSqx QhqL... Ihx FqnW qIJF QkFqb"
DATA "YFIk qnLq JIh R LIT - R xQh'k phQY..."
DATA "R'Sq xqJRxqx kQ pqqW I nQY WbQORnq Rh kFq WbQCbIDDRhC JQDDEhRkRqL R'D WIbk QO"
DATA "FQYqSqb R LkRnn ID JQxRhC Ihx FQWq kQ wq Iwnq kQ JQhkbRwEkq kQ js JQDDEhRkT"
DATA "R'Sq kbRqx QkFqb sVKgc nIhCEICqL IL Yqnn R'D JQhkRhERhC kQ nqIbh WTkFQh"
DATA "wEk R Oqqn FQDq Ik js Ihx LRhJq R'Sq nqIbhqx LQ DEJF IwQEk Rk Rk YQEnx"
DATA "wq I LFIDq kQ AELk LkQW Ihx oERk qSqbTkFRhC R'Sq nqIbhqx LQ OIb Rh js"
DATA "LQ R'D JQhkRhERhC YRkF js...RO kFqbq RL LQDqkFRhC R'Sq nqIbhqx ObQD kFq nILk TqIb"
DATA "Rk'L kFIk R xQh'k Lqqp kQ ORhx ObRqhxL Qb kQ xQ kFq LQJRInRNRhC kFRhC"
DATA "R'D AELk nQQpRhC kQ nqIbh FQY kQ RDWbQSq DT JQxRhC LpRnnL Ihx kQ pqqW DTLqnO QJJEWRqx"
DATA "DT xqIb bqIxqb R YRLF TQE Yqnn Ihx OIbqYqnn... DITwq Yq LFqnn Dqqk LQDqxIT LQDq LEhhT xIT"
DATA "TQEbL - bQh77"
 
 

the message that is encrypted in this code is the following:

testing testing one two three four this is an encoded text message for testing the encoder decoder code one plus one is two ten multiply by ten is one hundred... i hope i don't have spelling mistakes... today was a beautiful day with warm weather and sunny sky it's five four-thy eight pm here and the sun just set whoever you are and what ever your doing i hope and wish you well may we all continue to learn and progress in our way in life may we all learn to be better coders and programmers in whatever programming language we choose to learn... may the FB community shell continue to evolve and stay relevant in the programming languages i still code in FB as well other languages and everyday i learn something new everyday i code something new or work on something in code coding is an excellent way to forget troubles and worries of every day's life i hope someday the corona or covid pandemic will be behind us all till then i hope we all stay healthy safe and protected... and stay in touch with our loved ones... and help each other what else can i say - i don't know... i've decided to keep a low profile in the programming communities i'm part of however i still am coding and hope to be able to contribute to FB community i've tried other BASIC languages as well i'm continuing to learn python but i feel home at FB and since i've learned so much about it it would be a shame to just stop and quit everything i've learned so far in FB so i'm continuing with FB...if there is something i've learned from the last year it's that i don't seek to find friends or to do the socializing thing i'm just looking to learn how to improve my coding skills and to keep myself occupied my dear reader i wish you well and farewell... maybe we shell meet someday some sunny day yours - ron77