shell string encrypting and decrypting

The first:

This command will let you enter a string and then output will be a series of encrypted digital.

Encrypted code

python -c 'print reduce(lambda a,b: a*256+ord(b), raw_input("string: "), 0)'

Decrypted code [the number + P]

Digital output P dc -e

The second:

With RCOSR8toZ7nF9Gyc as plain text, encryption in two steps, of course, but also can step off, stay say ~

Encrypted code

echo "RCOSR8toZ7nF9Gyc" |xxd -ps -u

Get: 52434F535238746F5A376E46394779630A

echo "ibase=16;52434F535238746F5A376E46394779630A" |bc
Get: 27992624244640545969914199055074927928074

Previous encrypted code

echo "ibase=16; $(echo "RCOSR8toZ7nF9Gyc" |xxd -ps -u)" |bc
Get: 27992624244640545969914199055074927928074

Decrypted code

dc -e 27992624244640545969914199055074927928074P
Get: RCOSR8toZ7nF9Gyc
 

Third:

Also used as a plaintext RCOSR8toZ7nF9Gyc, look at the code:

Encrypted code

echo "RCOSR8toZ7nF9Gyc" |base64 -i
Get: Z3RhbGtAZ21haWwuY29tCg ==

Decrypted code

echo "Z3RhbGtAZ21haWwuY29tCg==" |base64 -d

Get: RCOSR8toZ7nF9Gyc

 

Guess you like

Origin www.cnblogs.com/opma/p/11607300.html