Cryptography Learning (i) Python implements two simple cryptographic algorithms

Source: Internet
Author: User
string Reverse Output

As the name suggests = =|

#!python3.3

def stringreverse (s): "" "
    @param s:string
    @return: Reversed string
    @example:
    Stringreverse (' abc ')
    output CBA "" "Return
    s[::-1]  #start: end:step


Caesar's password replaces the letter with the following key letter, such as key=3 a-> d b-> e c-> f ...

#!python3.3

def caesarcipher (S, key): "" "
    @param s:text needs encrypt/decrypt
    @param key: Positive if encryption, negative if decryption
    @return: The encrypted or decrypted text   
    ""
    import string< C19/>a = string.ascii_lowercase
    b = string.ascii_uppercase
    key = key%      #key must be within 0-25
    t A = A[key:] + a[:key]
    TB = B[key:] + b[:key]
    table = S.maketrans (a+b, TA+TB) return
    s.translate (table)


Bouns

http://www.blisstonia.com/software/WebDecrypto/index.php

As long as it's a replacement password (simply by replacing one letter with another), this site will certainly give you a wonderful answer:)

Http://www.ssynth.co.uk/~gay/anagram.html

http://wordsmith.org/anagram/

To reorganize letters into words, such as REHIPC into cipher

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.