Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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

C#
            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..
Posted

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?
 
Share this answer
 
Comments
version_2.0 27-Jul-11 2:42am    
while I am searching google i am getting losts of methods about it

but now, what i need is, Is there any common method(usally doing methods)
to achieve my goal...

I have already searched this System.Speech.SpeechRecognitionEngine, System.Speech.SpeechRecognizer

If possible redirect me to any good tutorial...

Thanks in advance...
OriginalGriff 27-Jul-11 2:49am    
No, there isn't. It is a complex subject, not being worked on my that many people. You are going to have to do basic research into what makes a voice sample unique to a person, rather than "where can I find copy'n'paste code from" research.
version_2.0 27-Jul-11 2:55am    
ok.. got it.. Thanks..
version_2.0 19-Aug-11 1:28am    
First of all sorry,
u were right.
I have to do research on voice.
I took lots of time to realize that. but, I cant do this with out your help.. sir could you please tell me that form where i have to start my research. I am totally blank..
OriginalGriff 19-Aug-11 3:48am    
Google, as always: Start here, and follow what looks like it may help. I think you have a big task on your hands though!
http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=basics+of+human+voice+print+identification
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
 
Share this answer
 
Comments
Asish Limbu 28-Jul-11 3:04am    
Good Stuff and Nice Links too. bookmarked for future ref.+5.
Sergey Alexandrovich Kryukov 31-Jul-11 23:44pm    
Thank you, Asish.
--SA
version_2.0 28-Jul-11 3:19am    
OK.. I tried the above method yesterday...
but right now.. i am facing language problem..
For example..
if i say Bonjour(Bonjour is a French word meaning Hello)..
i need the maximum possible spelling(s)(Eg: Bonjour,Bonjor,Bunjour)..
Like what the soundx function is doing in SQL..
But i known that for this I have to add the spelling(s) of 'Bonjour' to
my dictionary..
soundx function is also working like this(It is also returning words(best possible matches) form the column that we are specifying in the select query..

I need to know that is there any built in function which returns the best possible matches(with different spelling) of a word that we are giving as the parameter of that function...


For example:-

string[] arrayName=BuiltInFunction(word);
\\arrayName must contains the different spelling of that word

simply

string[] arrayName=BuiltInFunction(night);

\\arrayName contains 'night','nyt','ni8','n8',..

Need your help...
Sergey Alexandrovich Kryukov 31-Jul-11 23:52pm    
I do understand enough French to understand your example, but don't seriously know the language. :-) First, I never tried speech recognition engine in the languages other then English. Secondly, the engine always uses some particular language and uses its internal vocabulary. You can uses either DictationGrammar which essentially uses the whole vocabulary, or you should create your grammar based on some sub-set of the vocabulary and some meaningful combination of words in order to be recognized. With DictationGrammar you will have a lot of errors, however, it depends on particular engine, quality of pronunciation and other factors. You cannot use your own words with different spelling, etc. They should be correct words from the vocabulary known to a particular engine.
--SA
Wonde Tadesse 30-Jul-11 17:46pm    
5+
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[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900