|
Hi everyone
I am trying to write a code for an IIR filter. And for that purpose i need to implement the below function in C :-
out[n] = in[n] - ((b1 * e^jw * out[n-1]) + (b2 * e^2jw * out[n-2]))
Now, am facing problem ... well, rather i have no idea , as to how to implement the e^jw function in C. The value of w is known to me and n = the sample number.
It would be great if anyone could help me out.
Thanks a lot !!
|
|
|
|
|
Is this what you need?
exp (x) - returns e to the power x, where e is the base of the natural logarithm
Judy
|
|
|
|
|
hey Judy
I knew of exp(x) , but what i need is a solution for e^jx, j being the complex number.
|
|
|
|
|
Hazardcoder wrote: I knew of exp(x) , but what i need is a solution for e^jx, j being the complex number.
Ah, couldn't tell what j was - you didn't mention it in your original post and it's been way too long since I coded an IIR. Can't help with complex off the top of my head. I'd imagine someone somewhere has written a complex math library. Have you googled for that?
Judy
|
|
|
|
|
Yup , I did , there's a complex.h library available , but this library works only for C++ . I need for C.
|
|
|
|
|
The code depends on how you are representing your complex numbers in c, but what you need is
exp(jw) = cos(w) + j sin(w)
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
You can write your own funktions with a structur like:
sturct Complex
{
int r;
float phi;
//or with int rel and img
};
the exp(j*w) is only a rotation around the Point 0
it works like:
phi += w;
but i remember the form of an digital IIR filter is
out[n] = in[n] - ((b1 * out[n-1]) + (b2 * out[n-2]))
because the e^jw works like a delay, so
e^jw ^= out[n-1] and e^j2w ^= out[n-2]
but i'm not sure
i hope i can help you
|
|
|
|
|
I need to use Cryptographic API provided by Windows for my project. I am using the following:
CryptAcquireContext
CryptCreateHash
CryptHashData
CryptDeriveKey
After generating a session key using CryptDeriveKey, I am trying to export the key into a ket blob and saving it in a file in the followinng manner
CryptExportKey(hKey,0,PUBLICKEYBLOB,0,pbKeyBlob,&dwKeyBlobLen)
I get a NTE_BAD_KEY error. Can anyone please point out the error here and let me know the correct way of exporting the keys?
|
|
|
|
|
I didn't think you could export a hash key.
Maybe you need to use CryptDeriveKey (CRYPT_EXPORTABLE) on the hash key?
*edit* ack you already use that I can read, really.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I dont understand...the CryptDeriveKey() generates a session key and CryptExportKey() can export session/public/private keys. If I cannot export a hashed session key isn't MSDN contridicting itself?
|
|
|
|
|
If you reread my post I edited it
Something is going wrong before the CryptExportKey() call.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am using KEYLENGTH|CRYPT_EXPORTABLE flag in CryptDeriveKey()....I should have mentioned in my earlier posting.
So do you mean the key is getting corrupted some where after CryptDeriveKey() and before CryptExportKey()? I have been debugging the code but cant find this?
|
|
|
|
|
That's what I first thought until I reread your post (once again, I apparently can't read)
and noticed the PUBLICKEYBLOB type. You probably need to use SIMPLEBLOB since CryptDeriveKey
creates a session key, not a public key.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Wait. Try CryptExportKey with SIMPLEBLOB instead of PUBLICKEYBLOB
Sorry for the confusion!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am using PUBLICKEYBLOB since this function allows mee to export the key with out the handle to a cryptographic key of the destination user
|
|
|
|
|
Right but I don't think that will work on a session key.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
So What do I do for exporting the session key? I dont have the destination users CSP container or key
|
|
|
|
|
|
Need help to design a honeypot to attract the attackers and track their activities.I googel to find some sources but cudn't find any.
|
|
|
|
|
Do you have honey to put in said pot?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Don't you know honey attracts bears?!?
|
|
|
|
|
Does your intent a tools for increase security of network?
|
|
|
|
|
MFC may or may not be the best tool (likely not) to build a honeypot, but this depends on the kind of honeypot you are trying to build. Are you trying to build something to attract and track the activity of a so-called "blackhat"? Or something that basically is a spam-poisoning honeypot/spamtrap? Etc.
There are quite a few different kinds of honeypots available recently, so it should be rather easy to Google for something to look at and/or play around with.
Peace!
(I know this is a reply to the wrong post, but the parent vanished while I was composing my reply, and there is not even a "message deleted" line?)
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I googled but i didnt get any sources and I want to track their activity.
|
|
|
|
|
Its an answer to me or to sender?;P
|
|
|
|