|
Hello Everybody,
In my program i have to encrypt the password and i have to store it in the SQL server database.
It should by very strong.
Could you please give me a hint
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
The Cryptography namespace is full of options. MD5 is definately not a secure option, FWIW.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you Christian.
What do you mean by FWIW, is it a encryption method. plz don't mistake me
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
For What It's Worth = FWIW
Use SHA256 - that's pretty strong - we use it in my company (note I'm not saying WHICH company)
Mark
|
|
|
|
|
Thank you for your kind suggesstion
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Mark Greenwood wrote: we use it in my company (note I'm not saying WHICH company)
Most companies use this I suspect - as it is very easy to use and very strong. Usually with a strong password as well.
|
|
|
|
|
When i tried and go through the SHA256 algorithm i felt it is very difficult to implement and they have used it for encrypting the files but i have to get a password from the user and i have to encrypt the password and i have to store it in the database.
Please give me your suggestions because i am new to this concept
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
I'm having difficulty returning a nested object through a WCF service. A nudge in the right direction would be much appreciated! Here's what I'm doing:- I have 2 data contracts (classes
Foo and Bar ) defined thusly:
[DataContract]
[Serializable]
public class Foo
{
[DataMember]
public string FooData;
[DataMember]
public Bar TheBar;
}
[DataContract]
[Serializable]
public class Bar
{
[DataMember]
public string BarStringData;
[DataMember]
public int BarIntData;
} - My service consists of a single operation:
[ServiceContract()]
public interface IMyService
{
[OperationContract]
Foo GetFoo();
} GetFoo() is implemented as:
public Foo GetFoo()
{
Foo f = new Foo();
f.FooData = "foo";
f.TheBar = new Bar();
f.TheBar.BarStringData = "bar";
f.TheBar.BarIntData = 42;
} - When the service is invoked, it returns a
Foo object that contains a Bar object. However, the properties of the Bar instance aren't returned - its BarStringData is null and its BarIntData is zero. Any idea what I'm doing wrong?
/ravi
|
|
|
|
|
Try making TheBar, BarStringData and BarIntData properties instead of fields.
Can you also try an operation like GetBar(<some values="" for="" bar="" fields="">) to verify the corectness of the Bar object (before turning fields in properties and after...)
Horia Tudosie
|
|
|
|
|
Actually they are already properties. (I omitted that to keep the post short). The Bar object is correctly being constructed on the server.
/ravi
|
|
|
|
|
Hi all,
I've been stuck for the last two days on quite a strange problem. Here's what's happening: I'm calling a C++ function defined in some dll. Some of the parameters in the function are defined as 'out'. The problem that I am facing is with the out parameters, some of the data is 'lost' in transition.
Perhaps some code will help. The following is the C# wrapper function:
[DllImport("SomeDll.dll", EntryPoint = "SomeFunction")]<br />
private static extern bool SomeFunction(<br />
[MarshalAs(UnmanagedType.LPStr)] string str1,<br />
[MarshalAs(UnmanagedType.LPStr)] string str2,<br />
[MarshalAs(UnmanagedType.LPStr)] string str3,<br />
[MarshalAs(UnmanagedType.LPStr)] string str4,<br />
long longNum,<br />
out SomeStruct dataStruct,<br />
out int int1,<br />
out int int2);<br />
And this is the prototype of the C++ function that is being called:
BOOL SomeFunction(<br />
const char* str1,<br />
const char* str2,<br />
const char* str3,<br />
const char* str4,<br />
const long longNum, <br />
SomeStruct* dataStruct,<br />
int& int1,<br />
int& int2)<br />
When I step through the C# code, I find that the dataStruct structure is returned as 'null' (i.e. all values zeroed). The value of int2 is being returned correctly but in the 'position' of int1. The int2 that is returned is unchanged from before the function was invoked. I.e. if I expect to get 5000 from int2, int1 would instead give me that value of 5000 and int2 would be unchanged.
When I step through the C++ code, I find that the dataStruct structure is being received as null from the C# caller but the two ints are set to the correct values before the routine finishes.
The four strings and the long are passed in without any problems.
Based on what I see with the null structure (it should not be observed as being null on the C++ side as it had already been allocated some memory in the C# side of things) and the strange behaviour of int1 and int2, my guess is that the problem lies in how the parameters are being 'wired up'. Unfortunately, I can't see where I've screwed up (the SomeStruct structure is used in other routines in almost exactly the same way and works fine there).
Would appreciate any ideas/comments.
cheers!
|
|
|
|
|
jozsurf wrote: the SomeStruct structure is used in other routines in almost exactly the same way and works fine there
almost is the operative word I guess.
The symptoms you describe correspond to a problem with stack offsets, due to the
fact SomeObject is handled differently by both sides.
Your C function seems to output a pointer to some "SomeStruct". The wrapper function
needs to know how to convert such pointer into a "SomeStruct" itself.
You did not show the definition of SomeStruct; it probably needs some marshaling attributes.
Alternatively you could accept the pointer (have IntPtr in the prototype) and do the
conversion yourself, maybe using Marshal.PtrToStructure
|
|
|
|
|
Thanks for your reply Luc,
I tried using an IntPtr to get the pointer back (don't actually need to use the struct, just want to marshal the parameters correctly as I need the two ints at the end of the parameter list) but wasn't too successful. Unfortunately the values returned were same as before.
Nevertheless, you've given me a bit more food for thought; I've got a couple more things I can explore to get this going. I don't suppose you (or anyone else) could recommend a good learning resource for doing marshalling/interop stuff? I find that I'm wasting a lot of time doing things by trial and error and learning bits and pieces along the way...
cheers!
|
|
|
|
|
Hi,
lots of prototypes can be found on www.pinvoke.net
apart from that I discovered how to do what I needed by trial and error, I have no
definite tutorial or so.
best seems to experiment with own code on both sides (C# and C) so one can experiment
at will, and log everything.
Later on I also discovered there are quite a lot of articles on CodeProject that
use PInvoke...
BTW: you are not having trouble with Win64 are you ? (If you build one side with
64-bit pointers, so must be the other).
|
|
|
|
|
Hi,
I didn't get the e-mail notification for your last post, Luc! I came on to post the solution and just saw it...if I had read it, I possibly could have arrived at the solution much sooner.
Unsure if this was the situation you meant with the 64 bit pointers, but the problem was to do with the difference in definition of C#'s long (a 64 bit int) and C++'s long (a 32 bit int). Equating the two data types to be the same (as I was doing) was pushing the stack out of alignment.
cheers!
|
|
|
|
|
Yes, both Java and C# have real longs, twice the size of an int (as opposed to the
"long is at least as capable as int" in C and C++).
Tho that was not what I was hinting at; some people have difficulty combining
Win32 and Win64 code (having 4B and 8B pointers).
|
|
|
|
|
Hello,
Is there a way to display a custom image within a messageBox? Traditionally you would load custom text, but what about an image?
Thanks in advance!
Mr. O
|
|
|
|
|
I suspect you'd just create your own form and show it instead.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This[^] article may help.
/ravi
|
|
|
|
|
I think you must create ur own form.give same appearance as message box.make some setting changes. allow user to give image filename in some custom property.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
C# codes on how to connect to a Access database stored in C:\my documents\mydatabase.mdb
|
|
|
|
|
|
|
Convert ? No. Create an image and draw the path onto it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
sorry, second post tonight, i feel like i'm flooding this board !
This is probably going to sound really stupid: Is a .dll file just a class?
Is it possible to browse the .dll file and see what Methods is provides?
BACKGROUND :
I just saw how to make my computer Beep via P/Inovke using the following code:
<br />
[DllImport("kernel32.dll")]<br />
public static extern bool Beep(int freq, int duration);<br />
From what i gather, we need to go via this route because the .NET doesn't provide
functionality for sound. What i'm thinking now is that there must be loads of other things
that the .NET can't do and how would i go about finding out what else is out there? (other than having been a programmer since before the .NET )
I tried adding a reference to the kernel32.dll, with the mind that then i might be able to 'view it's contents' using the object-browser but i got an error.
Thanks ..
|
|
|
|