嗨,我对此有点新意,无法准确地弄清楚如何让它发挥作用。
这是我目前的代码:
import hashlib
def PasswordCreate():
password = input(str("Please enter a password next to this text"))
password = hashlib.md5()
password.update(password.encode('utf-8'))
return password.hexdigest()
PasswordCreate()
错误是:
AttributeError: '_hashlib.HASH' object has no attribute 'encode'
答案 0 :(得分:1)
你好Josh,
试试这段代码,
import hashlib
def PasswordCreate():
inputVar = input(str("Please enter a password next to this text: "))
password = hashlib.md5()
password.update(inputVar.encode("utf-8"))
return password.hexdigest()
# Create Variable for dipslay encoded value.
displayPass = PasswordCreate()
print "User Password is: ",displayPass
答案 1 :(得分:0)
或许类似以下内容:
import hashlib
def PasswordCreate():
password = raw_input(str("Please enter a password next to this text: "))
return hashlib.md5(password).hexdigest()
PasswordCreate()
答案 2 :(得分:0)
<template>
<div>
<input type="number" :value="count">
<button @click="updateCountPlus">+1</button>
</div>
</template>
export default {
props: ['id']
}
您的变量只是一个问题。请参阅我的代码中的Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true";
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
答案 3 :(得分:0)
尽可能简单:
import hashlib
print(hashlib.md5(input().encode()).hexdigest())