代码:

import hashlib
import base64

hash = hashlib.md5()
hash.update('逆火Tu22m'.encode('utf-8'))
print(hash.hexdigest())

hash = hashlib.sha1()
hash.update('逆火Tu22m'.encode('utf-8'))
print(hash.hexdigest())

print(base64.b64encode('逆火Tu22m'.encode()))
print(base64.b64decode(b'6YCG54GrVHUyMm0=').decode())

输出:

C:\Users\horn1\Desktop\python\48-codec>python md5sha1.py
45a06983108527b204b9b31b09e6fc5f
dee83555cfbbb78340bcd93ed056097b18e1fc78
b'6YCG54GrVHUyMm0='
逆火Tu22m

以上粗体部分为代码和输出

2018年5月14日

【Python】使用内置base64模块进行编解码的更多相关文章

  1. Python 简单统记Log 日记 下次用:python的内置logging模块 easy

    环境 win7  先来new一点log 日记   日记包含    "reason=", "error="  两个log级别 存放在D盘下得LOG目录下 先来 生 ...

  2. Python内置OS模块用法详解

    大家好,从今天起早起Python将持续更新由小甜同学从初学者的角度学习Python的笔记,其特点就是全文大多由新手易理解的代码与注释及动态演示.刚入门的读者千万不要错过! 很多人学习python,不知 ...

  3. python内置re模块全面实战

    目录 一:取消转义 二:python内置模块之re模块 三:常用方法 findall search match 简便 四:常用方法 finditer 匹配文件多情况 五:切割 替换 内置模块 六:分组 ...

  4. 【CobaltStrike】对CobaltStrike内置功能模块的了解

    对CobaltStrike内置功能模块的了解 0x00 右键功能列表 Interact 打开beacon Access dump hashes 获取hash Elevate 提权 Golden Tic ...

  5. python基础-内置函数详解

    一.内置函数(python3.x) 内置参数详解官方文档: https://docs.python.org/3/library/functions.html?highlight=built#ascii ...

  6. python基础——内置函数

    python基础--内置函数  一.内置函数(python3.x) 内置参数详解官方文档: https://docs.python.org/3/library/functions.html?highl ...

  7. Python的内置函数

    python的内置函数一共有68个,下面将简单介绍各个函数的功能. abs() dict() help() min() setattr() all() dir() hex() next() slice ...

  8. Python入门-内置函数一

    什么是内置函数?就是python给你提供的拿来直接用的函数,比如print,input等等,截止到python版本3.6.2 python一共提供了68个内置函数,他们就是python直接提供给我们的 ...

  9. day05 模块以及内置常用模块用法

    内置常用模块详解: 1 time 2 datetime 3 random   4 os 5 sys 6 shutil 7 shelve 8 xml 9 configparser 10 hashlib ...

随机推荐

  1. What is CMSIS-DAP

    The mbed HDK and mbed-enabled hardware support the CMSIS-DAP debug interface, which consists of an a ...

  2. IAR EWARM __iar_program_start, __iar_data_init3, __iar_copy_init3, __iar_zero_init3

    #include <stdint.h> // The type of a pointer into the init table. typedef void const * table_p ...

  3. SourceTree的简单使用

    原文网址:http://blog.csdn.net/u011439289/article/details/42126507 今天开始参与公司项目的代码编写,公司内部采用的是gitlib,所以用到了So ...

  4. 解决ubuntu上在androidstudio中启动emulator闪退的问题(1)

    作者 彭东林 pengdonglin137@163.com 平台 Ubuntu14.04 64 androidstudio 2.3.3 现象 在创建好模拟器后,点击启动时,模拟器界面刚出来就闪退了 解 ...

  5. 委托, 泛型委托,Func<T>和Action<T>

    使用委托来做一些事情,大致思路是: 1.定义声明一个委托,规定输入参数和输出类型.2.写几个符合委托定义的方法.3.把方法列表赋值给委托4.执行委托 internal delegate int MyD ...

  6. 设计模式之命令模式(Command)

    from::http://www.cnblogs.com/itTeacher/archive/2012/12/04/2801322.html 命令模式将一个请求封装为一个对象,从而使你可用不同的请求对 ...

  7. kettle 数据提取效率提升

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/xpliruizhi123/article/details/54580850 最近发现KETTLE抽数 ...

  8. 以绑定的方式来启动service

    先说下原理,之前我们的启动service就是用startService来启动的,这是显式启动.启动后我们无法得到service中的数据,也无法知道它执行的状态,如果我们要启动它的activity和它建 ...

  9. 用ArrayAdapter来创建Spinner(自定义布局、默认布局、动态内容、静态内容)

             android:dropDownWidth 下拉列表宽度 android:dropDownHorizontalOffset 下拉列表距离左边的距离 android:dropDownV ...

  10. Binary Search Tree 以及一道 LeetCode 题目

    一道LeetCode题目 今天刷一道LeetCode的题目,要求是这样的: Given a binary search tree and the lowest and highest boundari ...