PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

BASH AND PERL ENCRYPTION AND DECRYPTION

Go down

BASH AND PERL ENCRYPTION AND DECRYPTION Empty BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk 13th January 2016, 19:10

Encryption


Code:
encrypt=`perl -e 'print unpack "H*","plaintext here"'`
echo $encrypt
# Usage: bash encrypt.sh

Code:

descrpt=`perl -e 'print pack "H*","encrypted text here"'`
echo $descrpt
# Usage:  bash decrypt.sh

https://app.box.com/s/cx77cvrdk90ae5nzk8meq8yf9bkj9lku


Last edited by jamied_uk on 13th January 2016, 19:48; edited 2 times in total
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

BASH AND PERL ENCRYPTION AND DECRYPTION Empty Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk 13th January 2016, 19:11

echo Hi | openssl enc -aes-128-cbc -a -salt -pass pass:wtf
U2FsdGVkX18qAdhqop1SffsewHue6EOPNKv9dXc/0rI=

echo U2FsdGVkX18qAdhqop1SffsewHue6EOPNKv9dXc/0rI= | openssl enc -aes-128-cbc -a -d -salt -pass pass:wtf
Hi


http://how-to.linuxcareer.com/using-openssl-to-encrypt-messages-and-files
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

BASH AND PERL ENCRYPTION AND DECRYPTION Empty Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk 13th January 2016, 19:14

Code:
 /opt/local/bin/aes -e -b -s "Encrypted me" -p password
hq6kK1M5d5x45DCF7pmELXUzW3ARHV9A/zJcTw==
 /opt/local/bin/aes -d -b -s "hq6kK1M5d5x45DCF7pmELXUzW3ARHV9A/zJcTw==" -p password
Encrypted me
flags:
-e encrypt
-d decrypt
-b base64 encode/decode (otherwise you get non-printable chars)
-s this_string (blank for stdin)
-p the encryption/decryption password
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

BASH AND PERL ENCRYPTION AND DECRYPTION Empty Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk 13th January 2016, 22:08

Ceasar Cipher


Code:
# Caesar cipher Usage: bash function.sh
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[X-ZA-W]'
# output: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD

# Caesar cipher decoding
echo "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" | tr '[X-ZA-W]' '[A-Z]'
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG


# Can also be adjusted to ROT13 instead
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[N-ZA-M]'
# output: GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT

echo "GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT" | tr '[N-ZA-M]' '[A-Z]'
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG


# Case-sensitive version of ROT13
tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

BASH AND PERL ENCRYPTION AND DECRYPTION Empty Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum