在C#中通过语音进行密码验证 [英] Password Athentication through voice in C#

查看:82
本文介绍了在C#中通过语音进行密码验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在开发一个应用程序,为此,我需要在C#中使用语音识别..

我已在SQL Server中将密码(作为语音而不是文本)保存为图像数据类型,

并且在进行身份验证(登录)时.

我正在将用户输入作为.wav文件输入到我的应用程序启动路径.

我需要使用原始密码检查此用户输入,该密码已保存在数据库中

为此,我使用了字节数组验证方法,并为此使用了此代码

Hai all,

I am devolping an application, for that i need to use voice athentication in C#..

I have saved my password(as voice not text) in SQL server as image datatype,

and while in time of authentication(login).

I am getting user input as .wav file to my Application Startup path.

and i need to check this user input with orginal password which is saved in database

for that i used byte array verfication method, and i used this code for that

            try
            {
                byte[] b1 = File.ReadAllBytes(Application.StartupPath + "\\password.wav");\\ where password.wav is the user input
                byte[] b2 = Getbytes(username);\\this method will return a byte array of password of that corresponding username


\\Checking

                if (b1.SequenceEqual<byte>(b2) == true)
                {
                    MessageBox.Show("Welcome "+username+", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Sorry Try again", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("File Not Found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }




但是在测试这段代码时...

字节数组不相等,因此

我无法实现我的目标...

我的问题是..还有其他想法(方法)可以实现我的目标..

请帮忙..




but when tested this code...

the byte array is not getting equal,so that

I can''t achieve my goal...

My Qustion is.. Is there any other Idea(method) to achive my goal..

Please help..

推荐答案

求求您!您需要对语音识别进行一些基础研究.正如我昨天向您建议的那样,谷歌可以提供帮助,但是您将不得不做一些工作.

您尝试使用的简单方法永远行不通.为什么不?第一个简单原因:

您何时开始在每个样本中交谈?在同一时间(以微秒为单位)?因为如果您不这样做,则这两个样本将无法匹配.

第二个简单原因:

当您签名时,签名是否完全相同?仅限于CSI ...是什么让您认为您的声音会有所不同?
For goodness sake! You need to do some basic research into voice regocnition. As I suggested to you yesterday, google can help, but you are going to have to do some work.

The simple approach you are trying to use will never work. Why not? A first, simple reason:

When did you start talking in each sample? At exactly the same time in microseconds? Because if you didn''t there is no way the two samples will match.

A second simple reason:

When you sign your name, are the signatures absolutely identical? Only in CSI... What makes you think your voice will be any different?


完全错误的方法!我同意格里夫.您的问题很简单.

将文本密码存储在数据库中.使用某些加密散列函数以散列形式进行操作,请参见 http://en.wikipedia.org/wiki /Cryptographic_hash_function [ ^ ].使用SHA系列的功能之一,请参见 http://en.wikipedia.org/wiki/SHA-2 [^ ].使用.NET SHA *哈希函数之一,请参见 http://msdn.microsoft .com/en-us/library/system.security.cryptography.hashalgorithm.aspx [ http ://msdn.microsoft.com/zh-CN/library/system.speech.recognition.aspx [
Totally wrong approach! I agree with Griff. Your problem is fairly simple.

Store text password in your database. Do it in hashed form using some cryptographic hash function, see http://en.wikipedia.org/wiki/Cryptographic_hash_function[^]. Use one of the functions from the SHA family, see http://en.wikipedia.org/wiki/SHA-2[^]. Use one of .NET SHA* hash functions, see http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.aspx[^].

For login, use voice recognition. You need to use one of the two classes: System.Speech.RecognitionSpeechRecognizer or System.Speech.RecognitionSpeechRecognitionEngine, see http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx[^]. Using speech recognition is fairly simple; you will find some good code samples.

When the password is recognized, hash it and compare with hashed password.

Important note: this activity will give you very week security. First, anyone can hear the password. More importantly, recognition needs grammar. You can use so called DictationGrammar which is available and supplied with the engine, but it is huge and will give you a lot of false recognitions. You can supply smaller grammar, say, 100-200 candidate key words, but correct password should be included. At the moment of installation of grammar, all candidate words will be presented in its original forms, not in hashed form. If someone could possibly retrieve this grammar from where it''s stored, the password could be obtained by trying all words in the grammar. You could improve it by generating unique grammar on the fly for each login, but the mere fact that the correct password is to be known to the system (which is not the case in hashed-only approach) would compromise security. In all cases, you should understand security very well to provide reasonable secure scenario.

—SA


除了作为解决方案提供的解决方案之外,Microsoft还在.NET Framework 4中提供了简单有趣的Speech类.这是整篇MSDN文章. a href ="http://msdn.microsoft.com/zh-cn/library/system.speech.recognition.aspx"> System.Speech.Recognition命名空间 [
In addition to what is given as solutions, Microsoft provided easy and interesting Speech class in .NET framework 4. Here is the whole MSDN article.System.Speech.Recognition Namespace[^]


这篇关于在C#中通过语音进行密码验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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