【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 ...
随机推荐
- Java知识系统回顾整理01基础03变量03字面值
一.字面值定义 创建一个Hero对象会用到new关键字,但是给一个基本类型变量赋值却不是用new. 因为基本类型是Java语言里的一种内置的特殊数据类型,并不是某个类的对象. 给基本类型的变量赋值的 ...
- Example Code for a TMP102 I2c Thermometer————Arduino
参考:https://playground.arduino.cc/Code/TMP102/ Example Code for a TMP102 I2c Thermometer I've fairly ...
- ==38254==Sanitizer CHECK failed报错解决
跑代码时发现有如下报错: LeakSanitizer: bad pointer 0x7ffd00735130==38254==Sanitizer CHECK failed: ../../../../l ...
- 编程体系结构(07):JavaEE之Web开发
本文源码:GitHub·点这里 || GitEE·点这里 一.基础概念 1.CS与BS架构 CS架构模式 客户端/服务器(Client/Server)模式,既要编写服务器端程序,也要开发客户端程序,软 ...
- java安全编码指南之:lock和同步的正确使用
目录 简介 使用private final object来作为lock对象 不要synchronize可被重用的对象 不要sync Object.getClass() 不要sync高级并发对象 不要使 ...
- ISCSI共享
共享存储 ISCSI共享 服务端 软件安装 Install epel-release: # yum install epel-release Install scsi-target-utils rpm ...
- Oracle体系结构概述与SQL解析剖析
Oracle服务器 是一个数据库管理系统,它提供了一种全面.开放.集成的方法来管理信息. Oracle服务器由Oracle数据库和Oracle实例组成. oracle数据库软件和Oracle数据库软件 ...
- java 的 callback
Java 本身没有回调这一说,但是面向对象可以模拟出来. 1. 回调接口对象 ICommand package com.git.Cmder; public interface ICommand { v ...
- 基于python实现链式栈
""" 链式栈 linkstack.py 思路分析: 1.源于链表结构 2.封装栈的操作方法(入栈,出栈,栈空,栈顶) 3.链表的开头作为栈顶(不用每次遍历,效率高,怎样 ...
- STM32时钟和定时器
时钟源 STM32包含了5个时钟源,分别为HSI.HSE.LSI.LSE.PLL. HSI是高速内部时钟.RC振荡器,频率为8MHz: HSE是高速外部时钟,即晶振,可接石英/陶瓷谐振器或接外部时钟源 ...