LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-26-2022, 07:14 PM   #1
rpartee1
LQ Newbie
 
Registered: Mar 2022
Posts: 4

Rep: Reputation: 0
How do you write this Linux code?


Question:
The Pointy Hair Manager wants to be double sure his double secret e-mail makes it to the appropriate person in the Department of Redundancy Department without being deciphered.
He wants you to encrypt it using your sed transform skills. So replace all letters, capital and lowercase and numbers with alternate characters. You'll need 62(IIRC) alternates and you can use fun stuff, remember to

escape (\) the really weird ones. You will need your script to output your encryption to a file.

The phm_double_secret.txt file is this:

To the Head of the Department of Redundnacy Department,

I believe that, with a bit of work, 33.33% of current system administration

staff, Bob, can be furloughed, saving approximately, oh, around $12,532.67

a year.

Please tell me the correct code in Linux? The phm_double_secret.txt file is this

This will bring my total cost savings proposal for the year up to four - the

point were my 25% bonus kicks in. Raising my salary by $72,000.53 a year.

Sincerely,

PHM

P.S. I do feel that I am underpaid - after all my staff works very hard!

Last edited by rpartee1; 03-26-2022 at 07:15 PM. Reason: incorrect heading
 
Old 03-26-2022, 07:54 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,153

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Yet another homework question from the OP.
 
1 members found this post helpful.
Old 03-26-2022, 08:27 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by rpartee1 View Post
Question:
The Pointy Hair Manager wants to be double sure his double secret e-mail makes it to the appropriate person in the Department of Redundancy Department without being deciphered.
He wants you to encrypt it using your sed transform skills. So replace all letters, capital and lowercase and numbers with alternate characters. You'll need 62(IIRC) alternates and you can use fun stuff, remember to

escape (\) the really weird ones. You will need your script to output your encryption to a file.

The phm_double_secret.txt file is this:

To the Head of the Department of Redundnacy Department,

I believe that, with a bit of work, 33.33% of current system administration

staff, Bob, can be furloughed, saving approximately, oh, around $12,532.67

a year.

Please tell me the correct code in Linux? The phm_double_secret.txt file is this

This will bring my total cost savings proposal for the year up to four - the

point were my 25% bonus kicks in. Raising my salary by $72,000.53 a year.

Sincerely,

PHM

P.S. I do feel that I am underpaid - after all my staff works very hard!
Except for you, since you just post your work here for us to do for you

Again, show your efforts.
 
Old 03-26-2022, 09:10 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Welcome to LQ and the Programming forum!

Per the LQ Rules:

Quote:
Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member.
 
Old 03-28-2022, 08:19 AM   #5
hunkemoller
LQ Newbie
 
Registered: Oct 2013
Distribution: ubuntu
Posts: 7

Rep: Reputation: Disabled
just banish this freeloader [for ? a month / until they beg forgiveness and actually come clean about their inability to actually attempt to solve even the most trivial of 'challenges'
 
Old 03-28-2022, 06:54 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
^^ Please, we can, and should be more welcoming that that! It can be difficult to phrase first questions in a new forum. Hopefully, if the OP continues their study they will find their own place among the crowd!

Last edited by astrogeek; 03-28-2022 at 07:15 PM.
 
Old 03-29-2022, 01:20 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by astrogeek View Post
^^ Please, we can, and should be more welcoming that that! It can be difficult to phrase first questions in a new forum. Hopefully, if the OP continues their study they will find their own place among the crowd!
From my side I have only one question to the OP: what did you implement so far, where did you stuck, what is your actual problem?
 
Old 03-29-2022, 09:55 AM   #8
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
Ok, I'll play.

Example:

Code:
text="The Pointy Hair Manager wants to be double sure his double secret  
e-mail makes it to the appropriate person in the Department of Redundancy  
Department without being deciphered."

base64 <<< "$text" > text2.txt

cat text2.txt
VGhlIFBvaW50eSBIYWlyIE1hbmFnZXIgd2FudHMgdG8gYmUgZG91YmxlIHN1cmUgaGlzIGRvdWJs
ZSBzZWNyZXQgIAplLW1haWwgbWFrZXMgaXQgdG8gdGhlIGFwcHJvcHJpYXRlIHBlcnNvbiBpbiB0
aGUgRGVwYXJ0bWVudCBvZiBSZWR1bmRhbmN5ICAKRGVwYXJ0bWVudCB3aXRob3V0IGJlaW5nIGRl
Y2lwaGVyZWQuCg==

base64 -d text2.txt
The Pointy Hair Manager wants to be double sure his double secret  
e-mail makes it to the appropriate person in the Department of Redundancy  
Department without being deciphered.
Authenticate:
Code:
base64 <<< $(echo abcdefg)
YWJjZGVmZwo=
auth.sh
Code:
#!/usr/bin/bash

#Correct answer is abcdefg
read -p "Type your secret code: " secr
scode=$(echo 'YWJjZGVmZwo=' | base64 --decode)

if [ $secr == $scode ]; then
    echo "You are authenticated"
else
    echo "You are not authenticated"
fi
Code:
bash ./auth.sh
Type your secret code: abcdefg
You are authenticated

bash ./auth.sh
Type your secret code: xyzabc
You are not authenticated
 
1 members found this post helpful.
Old 03-29-2022, 12:26 PM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by teckk View Post
Code:
base64 <<< $(echo abcdefg)
YWJjZGVmZwo=
no echo and $() required
Code:
base64 <<< pleasure
Otherwise I like it.

Last edited by pan64; 03-29-2022 at 02:01 PM. Reason: syntax fix
 
1 members found this post helpful.
Old 03-29-2022, 01:24 PM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Don't bother; OP has posted on a get-your-homework-done-for-you site:
https://www.chegg.com/homework-help/...depa-q94624593
 
1 members found this post helpful.
Old 03-29-2022, 02:07 PM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,041

Rep: Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348Reputation: 7348
Quote:
Originally Posted by TB0ne View Post
Don't bother; OP has posted on a get-your-homework-done-for-you site: ...
I'm not really sure if it was the same person (or a classmate).
I definitely would not pay ($15) for a solution on that site.

Last edited by pan64; 03-29-2022 at 02:11 PM.
 
Old 03-29-2022, 06:07 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by pan64 View Post
I'm not really sure if it was the same person (or a classmate). I definitely would not pay ($15) for a solution on that site.
Exact same wording, and email address starts with "rpartee1". Hard to imagine two people posting the exact same thing with the same words, and an almost identical user name.

Regardless, the OP hasn't responded to any of their threads, and until they do, there's little we can assist with.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] read txt file into an array and make a second txt file zimbot Linux - General 12 09-05-2015 01:39 PM
[SOLVED] Write a script that searches a txt file and write's specific data to a new file tomtweber Programming 22 02-22-2014 12:36 PM
[SOLVED] How to write a .sh script to read configuration file and write into .txt file ISStaras Linux - Newbie 8 09-06-2012 06:03 PM
cat onelinefile.txt >> newfile.txt; cat twofile.txt >> newfile.txt keep newline? tmcguinness Programming 4 02-12-2009 06:38 AM
How can read from file.txt C++ where can save this file(file.txt) to start reading sam_22 Programming 1 01-11-2007 05:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration