using rot13 and tr command for having an encrypted email address

前端 未结 5 2110
旧时难觅i
旧时难觅i 2020-12-13 06:04

I have read many tutorials on the internet about the usage of the \'tr\' command. However, I am not able to understand how to encrypt an email address with a shell script sh

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 06:29

    # Reciprocal Transformation(s)

    # rot13
    tr 'A-Za-z' 'N-ZA-Mn-za-m' <<< 'user@domain.com'
    
    # rot13.5 (rot18)
    tr 'A-Za-z0-9' 'N-ZA-Mn-za-m5-90-4' <<< 'user123@domain.com'
    
    # rot47
    tr '\!-~' 'P-~\!-O' <<< 'user123@domain.com'
    
    # rot13 -- SED anyone
    echo 'user@domain.com' | sed y/NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/
    

    Shell Script

    #!/bin/bash
    # Purpose: Rotate 13 characters (a reciprocal transformation)
    
    # ./rot13.sh 'A String to look Ciphered'
    tr 'A-Za-z' 'N-ZA-Mn-za-m' <<< "$1"
    
    exit $?
    

提交回复
热议问题