题目:

When you sign up for an account somewhere, some websites do not actually store your password in their databases. Instead, they will transform your password into something else using a cryptographic hashing algorithm.

After the password is transformed, it is then called a password hash. Whenever you try to login, the website will transform the password you tried using the same hashing algorithm and simply see if the password hashes are the same.


Create the function that converts a given string into an md5 hash. The return value should be encoded in hexadecimal.

Code Examples

passHash("password") // --> "5f4dcc3b5aa765d61d8327deb882cf99"
passHash("abc123") // --> "e99a18c428cb38d5f260853678922e03"

If you want to externally test a string, look at this website.


As a side note, md5 can be exploited, so never use it for anything secure. The reason I used it in this kata is simply because it is a very common hashing algorithm and many people will recognize the name.

解题办法:

import hashlib
def pass_hash(str):
return hashlib.md5(str.encode()).hexdigest()

知识点:

1、使用哈希的办法,先导入hashlib,再使用hashlib.md5(str.encode()).hexdigest()

【Kata Daily 190929】Password Hashes(密码哈希)的更多相关文章

  1. 数据库里账号的密码,需要怎样安全的存放?—— 密码哈希(Password Hash)

    最早在大学的时候,只知道用 MD5 来存用户的账号的密码,但其实这非常不安全,而所用到的哈希函数,深入挖掘,也发现并不简单-- 一.普通的 Hash 函数 哈希(散列)函数是什么就不赘述了. 1.不推 ...

  2. Kali-linux破解LM Hashes密码

    LM(LAN Manager)Hash是Windows操作系统最早使用的密码哈希算法之一.在Windows 2000.XP.Vista和Windows 7中使用了更先进的NTLMv2之前,这是唯一可用 ...

  3. CI框架 -- 密码哈希

    哈希算法是一个单向函数.它可以将任何大小的数据转化为定长的“指纹”,并且无法被反向计算 依赖性 crypt() 函数需支持 CRYPT_BLOWFISH 常量 PASSWORD_BCRYPT PASS ...

  4. php自带的密码哈希

    常用的MD5.SHA1.SHA256哈希算法,是面向快速.高效进行哈希处理而设计的.随着技术进步和计算机硬件的提升,如今强大的计算机很容易破解这种算法.也就是说,不要用MD5.SHA1.SHA256这 ...

  5. Fortify漏洞之Dynamic Code Evaluation: Code Injection(动态脚本注入)和 Password Management: Hardcoded Password(密码硬编码)

    继续对Fortify的漏洞进行总结,本篇主要针对  Dynamic Code Evaluation: Code Injection(动态脚本注入) 和 Password Management: Har ...

  6. [LeetCode] Strong Password Checker 密码强度检查器

    A password is considered strong if below conditions are all met: It has at least 6 characters and at ...

  7. Database Password Hashes

    SQL Server 2000:- SELECT password from master.dbo.sysxlogins where name=’sa’ 0×010034767D5C0CFA5FDCA ...

  8. asp.net core IdentityServer4 实现 resource owner password credentials(密码凭证)

    前言 OAuth 2.0默认四种授权模式(GrantType) 授权码模式(authorization_code) 简化模式(implicit) 密码模式(resource owner passwor ...

  9. Reset Password 重置密码 (CentOS 5,6,7 ; Juniper Networks: SRX100 )

    一些重置root 密码的文档分享(来自官网): CentOS 5,6,7 Juniper Networks :  SRX100 链接:https://share.weiyun.com/5BM4kwK ...

随机推荐

  1. 【题解】hdu4757 【TJOI2018】异或

    题目链接 题目大意:有一颗树,有点权,每次询问:一条路径\(x->y\)中与\(z\)异或的最大值,或是以\(x\)为根的子树中与\(y\)异或的最大值. 树剖--还是算了. 观察到,子树的\( ...

  2. 教你两步快速使用华为HMS沙盒(沙箱)测试

    沙盒(沙箱)测试允许在开发者在接入华为应用内支付IAP联调过程中无需真实支付即可完成端到端的测试. 第一步:添加测试账号 在AppGallery Connect中的"用户与访问"添 ...

  3. 2017年 实验五  B2B模拟实验

    实验五  B2B模拟实验 [实验目的] ⑴.掌握B2B中供应商的供求信息发布.阿里商铺开设和订单交易等过程. ⑵.掌握B2B中采购商的采购信息的发布.交易洽谈.网上支付和收货等过程. [实验条件] ⑴ ...

  4. 为什么说switch比if快

    C++的switch语法 在C++中,switch只接受整型常量作为分支的值: switch (expr) { case integral-constant : \\... break; case i ...

  5. set的运用 例题5-3 安迪的第一个字典(Andy's First Dictionary,Uva 10815)

    #include<bits/stdc++.h>using namespace std;set<string> dict;int main(){ string s, buf; w ...

  6. Lock、Synchronized锁区别解析

    上篇博文在讲解 ConcurrentHashMap 时说到 1.7 中 put 方法实现同步的方式是使用继承了 ReentrantLock 类的 segment 内部类调用 lock 方法实现的,而在 ...

  7. 树莓派调试PCF8591遇到的小问题

    错误提示:bus = smbus.SMBus(1) IOError: [Errno 2] No such file or directory 提示的内容为端口没有打开即IIC端口:如图,打开IIC使能 ...

  8. GO-数据类型

    目录 数据类型 1.分类 2.布尔类型 3.整型 4.浮点型 5.字符类型 6.字符串 7.复数类型 数据类型 1.分类 Go语言内置以下这些基础类型: 类型 名称 长度 零值 说明 bool 布尔类 ...

  9. 最新版Python 3.8.6 版本发布

    Python 3.8.6 发布了,它是 Python 3.8 的第六个维护版本. 3.8 系列的维护版本将每两个月定期更新一次,3.8.7 计划于 2020 年 11 月中旬发布. 随着维护版本的发布 ...

  10. airtest本地连接和远程连接

    一.本地连接 # -*- coding: utf-8 -*-# from poco.drivers.android.uiautomation import AndroidUiautomationPoc ...