【Kata Daily 190929】Password Hashes(密码哈希)
题目:
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(密码哈希)的更多相关文章
- 数据库里账号的密码,需要怎样安全的存放?—— 密码哈希(Password Hash)
最早在大学的时候,只知道用 MD5 来存用户的账号的密码,但其实这非常不安全,而所用到的哈希函数,深入挖掘,也发现并不简单-- 一.普通的 Hash 函数 哈希(散列)函数是什么就不赘述了. 1.不推 ...
- Kali-linux破解LM Hashes密码
LM(LAN Manager)Hash是Windows操作系统最早使用的密码哈希算法之一.在Windows 2000.XP.Vista和Windows 7中使用了更先进的NTLMv2之前,这是唯一可用 ...
- CI框架 -- 密码哈希
哈希算法是一个单向函数.它可以将任何大小的数据转化为定长的“指纹”,并且无法被反向计算 依赖性 crypt() 函数需支持 CRYPT_BLOWFISH 常量 PASSWORD_BCRYPT PASS ...
- php自带的密码哈希
常用的MD5.SHA1.SHA256哈希算法,是面向快速.高效进行哈希处理而设计的.随着技术进步和计算机硬件的提升,如今强大的计算机很容易破解这种算法.也就是说,不要用MD5.SHA1.SHA256这 ...
- Fortify漏洞之Dynamic Code Evaluation: Code Injection(动态脚本注入)和 Password Management: Hardcoded Password(密码硬编码)
继续对Fortify的漏洞进行总结,本篇主要针对 Dynamic Code Evaluation: Code Injection(动态脚本注入) 和 Password Management: Har ...
- [LeetCode] Strong Password Checker 密码强度检查器
A password is considered strong if below conditions are all met: It has at least 6 characters and at ...
- Database Password Hashes
SQL Server 2000:- SELECT password from master.dbo.sysxlogins where name=’sa’ 0×010034767D5C0CFA5FDCA ...
- asp.net core IdentityServer4 实现 resource owner password credentials(密码凭证)
前言 OAuth 2.0默认四种授权模式(GrantType) 授权码模式(authorization_code) 简化模式(implicit) 密码模式(resource owner passwor ...
- Reset Password 重置密码 (CentOS 5,6,7 ; Juniper Networks: SRX100 )
一些重置root 密码的文档分享(来自官网): CentOS 5,6,7 Juniper Networks : SRX100 链接:https://share.weiyun.com/5BM4kwK ...
随机推荐
- 090 01 Android 零基础入门 02 Java面向对象 02 Java封装 01 封装的实现 03 # 088 01 Android 零基础入门 02 Java面向对象 02 Java封装 01 封装的实现 04 使用包进行类管理(2)——导入包
090 01 Android 零基础入门 02 Java面向对象 02 Java封装 01 封装的实现 03 # 088 01 Android 零基础入门 02 Java面向对象 02 Java封装 ...
- 解决mvn clean install的报错The packaging for this project did not assign a file to the build artifact
解决mvn clean install的报错The packaging for this project did not assign a file to the build artifact
- VSCODE 配置eslint规则和自动修复
全局安装eslint 打开终端,运行npm install eslint -g全局安装ESLint. vscode安装插件 vscode 扩展设置 依次点击 文件 > 首选项 > 设置 { ...
- 多测师讲解htm_L标题标签001_高级讲师 肖sir
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>百 ...
- 汕尾6397.7539(薇)xiaojie:汕尾哪里有xiaomei
汕尾哪里有小姐服务大保健[微信:6397.7539倩儿小妹[汕尾叫小姐服务√o服务微信:6397.7539倩儿小妹[汕尾叫小姐服务][十微信:6397.7539倩儿小妹][汕尾叫小姐包夜服务][十微信 ...
- Pythonic【15个代码示例】
Python由于语言的简洁性,让我们以人类思考的方式来写代码,新手更容易上手,老鸟更爱不释手. 要写出 Pythonic(优雅的.地道的.整洁的)代码,还要平时多观察那些大牛代码,Github 上有很 ...
- 【UR #13】Yist
UOJ小清新题表 题目摘要 UOJ链接 给出一个排列 \(A\) 以及它的一个非空子序列 \(B\),给出一个 \(x\) 并进行若干次操作,每一次操作需要在 \(A\) 中选择一个长度恰好为 \(x ...
- 多路查找树(2-3 树、2-3-4 树、B 树、B+ 树)
本文参考自<大话数据结构> 计算机中数据的存储 一般而言,我们都是在内存中处理数据,但假如我们要操作的数据集非常大,内存无法处理了,在这种情况下对数据的处理需要不断地从硬盘等存储设备中调入 ...
- linux(centos8): 临时关闭/永久关闭交换分区swap?
一,为什么要关闭swap? 1,swap的用途? swap 分区就是交换分区,(windows平台叫虚拟内存) 在物理内存不够用时, 操作系统会从物理内存中把部分暂时不被使用的数据转移到交换分区, 从 ...
- Linux如何在vim里搜索关键字
例如搜索 the写法:/the +回车 /+关键字 ,回车即可.此为从文档当前位置向下查找关键字,按n键查找关键字下一个位置: ?+关键字,回车即可.此为从文档挡圈位置向上查找关键字,按n键向 ...