Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (2)

Powered by Vanilla. Made with Bootstrap.
How to use the base64 python module.
  • Flashlight
    Posts: 173
    So last night while working on my base64 encrypter i realized that there was nearly no documentation explaining how to use base encryption so i decided to write this tutorial.

    import base64

    This code above is the most vital part of the code as it tells python to import the base64 module which is needed for all us of base64 encryption
    Ok so now we have imported base64 we can now write a small little script to encode and print the string this would look like:
    import base64
    a = raw_input(\"What do you want to encode? \")
    b = base64.b64encode(a)
    print b

    This will encrypt a string using base64

    To decode the code would look like this:
    import base64
    c = raw_input(\"What do you want to decode? \")
    d = base64.b64decode(c)
    print d


    Now you have go the basics there are some more advanced things you can do with the base64 such as URL safe this replaces + with -,/ with _ and the results can still contain =

    You can also base32 encode, the code would look like:
    import base64
    a = raw_input(\"What do you want to encode? \")
    b = base64.b32encode(a)
    print b


    You can also use base 16 to encode, the code would look like:
    import base64
    a = raw_input(\"What do you want to encode? \")
    b = base64.b16encode(a)
    print b


    You can also decode both of these 2 above with:
    for base16
    import base64
    c = raw_input(\"What do you want to decode? \")
    d = base64.b16decode(c)
    print d


    For base32
    import base64
    c = raw_input(\"What do you want to decode? \")
    d = base64.b32decode(c)
    print d


    I hope people found this interesting and helpful.
  • Xin
    Posts: 3,251
    Nice! Very interesting tutorial , was very useful
    Xin
  • GameOver
    Posts: 675
    Good work! Keep up! Post this tutorials and I will give you one present! xD
  • Very Helpful!
    Thanks :)