Skip to content

Instantly share code, notes, and snippets.

@binary10
Last active October 7, 2017 16:21
Show Gist options
  • Save binary10/c6641131af9cf00ae267dc21a58db213 to your computer and use it in GitHub Desktop.
Save binary10/c6641131af9cf00ae267dc21a58db213 to your computer and use it in GitHub Desktop.

Revisions

  1. binary10 revised this gist Oct 7, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions base64.py
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,6 @@
    # Q29udmVydCBtZSB0byBiYXNlNjQh

    # Take base64 string and decode back to original string
    base64.b64decode(sb64)
    # b'Convert me to base64!'
    base64.b64decode(sb64).decode('utf-8')
    # 'Convert me to base64!'

  2. binary10 renamed this gist Oct 7, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. binary10 created this gist Oct 7, 2017.
    14 changes: 14 additions & 0 deletions base64
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import base64

    # Create a string and encode to bytes
    s = 'Convert me to base64!'
    sb = s.encode('utf-8')

    # Take bytes and encode to base64 string
    sb64 = base64.b64encode(sb).decode()
    # Q29udmVydCBtZSB0byBiYXNlNjQh

    # Take base64 string and decode back to original string
    base64.b64decode(sb64)
    # b'Convert me to base64!'