|
Dear Mike,
I don't think these are used for creating hashes for strings. For example if I do CryptCreateHash I had to do if(!CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0))
before that and if you do it two times CryptCreateHash you'll see that you don't actually get the same hashes so this will not work when you need to compare hash. This I believe is used for encryption.
What I need is to make a hash from username and password and make another one at the client side and compare the two.
Thanks.
vg
|
|
|
|
|
|
Dear Mike,
I have used the piece of code in this link to create a hash of an username and password on the server side and on the client side create another hash of an username and password. However when I compare the hashes they are not similar even though its the same string on both ends. Can you please help.
Thank you.
vg
|
|
|
|
|
vgandhi wrote: How do you hash two strings in C++
How do you compare two hashes in C++?
hashes have different purposes, as you see by your answers, there are perfect hashes, in which case you are trying to generate an absolute reference hash for two different strings of expected input. Cryptographic hashes try to be perfect hashes, when they are found to not be unique within the bit range of the expected input, this is considered a bug and they are fixed or replaced.
as for comparing... you need an api routine that runs on strings, run them, compare them. These are non-cryptographic hashes, similar to CRC but they are designed for optimum distribution range not just uniqueness. With optimized bit distribution of the result, you can mod the result to your own range.
http://www.azillionmonkeys.com/qed/hash.html[^] there is also a test project that compares the hash routines.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Question.
I am using overlapped child windows in a dialogue box. According to the documentation, OnNcActivate can be used to control the colour of the total bar, between active and inactive colours. However this message (OnNcActivate TRUE FALSE) is not being sent to the window for child windows. Is there another way of setting the titlebar state colour, or a way of ensuring that this message is sent to allow this to be controlled?
Thanks for any input
Sandy
|
|
|
|
|
Is there an ON_WM_NCACTIVATE entry in the mesage map for the window?
Mark
|
|
|
|
|
Yes ON_WM_NCACTIVATE is there
We are not getting as far as the OnNcActivate routine - we are just not getting the message from Windows for the child window.
Thanks for the response Mark. Any other ideas?
Sandy
|
|
|
|
|
Sandy Kinghorn wrote: we are just not getting the message from Windows for the child window
You're not trying to catch it in the parent, right?
Mark
|
|
|
|
|
Trying to catch via the windows message map. OnNcPaint is being passed through the map. OnNcActivate is not.
The window causing problems has a style of child set in its proerties, and is used as a child of a modal dialogue. Several instances are created o the fly, and need to indicate active one via its title bar.
thanks
Sandy
|
|
|
|
|
Sandy Kinghorn wrote: ...used as a child of a modal dialogue...
I think the built in activation only works on "top-level" windows, not on child windows. I tried
with imbedded overlapped children an couldn't get it to work either, whether the parent dialog
was modal or modeless.
The only way I know of to get the built in activation behavior with overlapped child windows is
to use MDI windows. Not necessarily a desired solution.
Otherwise you could look into indicating the active window some other way - drawing the title bar
yourself, changing the window frame appearance, etc.
Mark
|
|
|
|
|
I want to have a key shortcut to call a dialog in an MFC Application. CFormView I can do it in CView but for some reason I can't seem to get it to work in CView if anyone knows how please tell me.
Thanks
Jenn
|
|
|
|
|
You can use an "Accelerator" and in its handler you can open the dialog you want.
Your text is missing punctuation, so I am not sure I was able to understand it.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
I never read over my message sorry it didn't make much sense. I tried an accelerator but for some reason nothing seemed to happen. Do you know how exactly to do it???
|
|
|
|
|
How to get reference count on File handle... I mean how many process opened the paticular file...
|
|
|
|
|
The best is to open a file only for reading and writing and than giving it free. Other things are bad style.
Greetings from Germany
|
|
|
|
|
I don't see any API that exposes a handle's reference count.
Mark
|
|
|
|
|
i need to help in open gl programming in visual c++..can i post my doubt here..is this the right place...pls reply me as soon as possible...
|
|
|
|
|
makaveli_07 wrote: can i post my doubt here..
please don't cross post... though I can understand the reasons why asking in every forum with some of the heavy handed dealings with posters recently....
If the question is about specific implimentation, how to write the code, or what code to write, or how to use the API in C++ this is the "best" not necessarily the only fit.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I need to write some unicode text (using ScriptString API) in a dialog window. In main window I would place the drawing stuff in WM_PAINT, but how to deal with dialogs? Do I need to create some owner-drawn element and catch WM_DRAWITEM? If so, which owner-drawn element? I have never created custom controls, hope this won't end up with doing something that challenging.
If you can give also some advice how to make Unicode text's bacground transparent / custom color, if it is possible with a huge amount of work?
Thanks, and try to be as clarify as you can, I have very little WinAPI/ScriptString/Uniscribe/Unicode/whatever experiences.
|
|
|
|
|
i have an assignent to read txt from a file and then remove the extra spaces in the txt. so far i can open the file and display the text. i can't come up with a way of removing the spaces. i have been advised so far to either use strcmp, which i am not sure where that is going to get me, and to 'assign' the individual text to an array and then rejoin the array without the spaces. i firstly don't know how to assign the text to an array. when i try i get an error when compiling saying that i can't convert from 'string' to 'const char*'. can someone please help. i am new so please be gentle.
my code so far:
#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
using std::getline;
int main ()
{
string myStringErrors;
std::ifstream file("Lab1.txt"); //name of orignal file
if (!file)
{
std::cerr<<"Can't open file"<
|
|
|
|
|
use std::string::c_str() to get the C-style string contained in the std::string object
also, please use the <pre></pre> html tags in your messages when you post some code samples in the forum
|
|
|
|
|
i am not sure what you mean by that. how do i use std::string::c_str? what goes in the ()? thanks for the code posting help.
|
|
|
|
|
you put nothing in the parenthesis, this function receives no parameters :
std::string str = "hello";
char* psz = str.c_str();
printf("%s", psz);
|
|
|
|
|
|
zoobiskuit wrote: i can't convert from 'string' to 'const char*'
This is done by using std::string s member-function c_str() , which returns a const char* to the string contained.
You can the go through this const c-string on a char by char basis and copy anything save the extra spaces to another string.
Hope this helps.
P.S.:
"The light at the end of the tunnel is the light of the oncoming train"
or
"Due to the present economic uncertanities, the light at the end of the tunnel will be switched of until further notice"
-- modified at 7:41 Wednesday 24th January, 2007: fixed typo(notive -> notice)
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|