BASH AND PERL ENCRYPTION AND DECRYPTION

View previous topic View next topic Go down

BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk on 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
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk on 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
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk on 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
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by jamied_uk on 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]'
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: BASH AND PERL ENCRYPTION AND DECRYPTION

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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