【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 ...
随机推荐
- JavaScript求数组中元素的最大值
要求: 求数组[2,6,1,77,52,25,7]中的最大值. 实现思路: 声明一个保存最大元素的变量 max 默认最大值max定义为数组中的第一个元素arr[0] 遍历这个数组,把里面每个数组元素和 ...
- android中判断一个链接是否是有效的
private boolean isValid(String urlString) { try { URL url = new URL(urlString); return URLUtil.isVal ...
- CDH5部署三部曲之二:部署和设置
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- 多测师讲解python_模块(导入模块和内置模块)_高级讲师肖sir
#自定义模块# from aaa import * #指定导入某个包中具体的类.函数.方法## A.fun1(2,2) #import +模块名 :# # import +模块名+.+.+# # 导入 ...
- 【Jenkins】远程调用jenkins进行构建方式!
前提:jenkins支持远程调用(具体设置自行百度)1.在我的个人中心--configure--API TOKEN--如果没有,则添加一个token,并生成,再复制并记录下来2.在你的job上面加上你 ...
- CentOS安装MySQL详解 转
引言 最近某云搞活动,买了个服务器作为平时学习和测试用,新机器啥也没有,一些常用软件的安装是免不了的,于是乎想着把安装过程都详细记录下来,一是做个备忘,二是给有需要的同学作个参考. Linux上安 ...
- appium_android-常见的问题
po模型的原则: 用公共方法代表UI所提供的功能 方法应该返回其他的PageObject或者返回用于断言的数据 同样的行为不同的结果可以建模为不同的方法 不要在方法内加断言 字段意义 不要暴露页面内部 ...
- docker-docker-compose 安装
1.安装docker-compose(官网:https://github.com/docker/compose/releases) 安装: curl -L https://github.com/doc ...
- JS 计算日期相减得天数
言简意赅不呼哨直接懂,可以封装的可以根据自己的需求封装一下 var date1="2020-10-23";var date2="2020-10-26";var ...
- Vue 学习第二部
目录 通过axios实现数据请求 json json数据的语法 js中是提供的接送数据转换方法 ajax 数据接口 ajax的使用 同源策略 ajax跨域(跨源)方案之cors 组件化开发 组件[co ...