检查字符串是否为哈希 [英] Check if string is a hash

查看:128
本文介绍了检查字符串是否为哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SHA-512对我的密码进行哈希处理(当然是这样).我不认为我想要的是可能的,但是无论如何,让我们问一问.

I'm using SHA-512 to hash my passwords (with a salt ofcourse). I don't think that what I want is possible, but let's ask anyway.

是否可以检查字符串是否已经是SHA-512(或其他算法)哈希?

Is there a way to check if a string is a SHA-512 (or another algorithm) hash already?

当用户登录时,我想检查他的密码.如果仍为纯文本格式,则应将其转换为安全格式.

When a user logs in, I want to do a check on his password. If it's still in plain text, it should get converted to a secure form.

推荐答案

您的任务非常简单,不需要检查字符串.

Your task is extremely simple and require no strings checking.

只需将输入的密码与存储的一个密码进行比较即可.
如果匹配-这是一个普通密码.因此,您可以开始转换过程.

Just compare entered password with stored one first.
If matched - here it is, a plain password. So, you can start conversion process.

这篇关于检查字符串是否为哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆