|
Thanks. I kinda thought about it too. Here's what I came up with
Function HashPassword(ByVal password As String) As String<br />
Dim hashedPassword As String<br />
Dim hashProvider As SHA256Managed<br />
Try<br />
Dim passwordBytes() As Byte<br />
Dim hashBytes1() As Byte<br />
Dim hashBytes2() As Byte<br />
passwordBytes = System.Text.Encoding.Unicode.GetBytes(password)<br />
hashProvider = New SHA256Managed<br />
hashProvider.Initialize()<br />
hashBytes1 = hashProvider.ComputeHash(passwordBytes)<br />
hashBytes2 = hashProvider.ComputeHash(hashBytes1)<br />
hashedPassword = Convert.ToBase64String(hashBytes2)<br />
Finally<br />
If Not hashProvider Is Nothing Then<br />
hashProvider.Clear()<br />
hashProvider = Nothing<br />
End If<br />
End Try<br />
Return hashedPassword<br />
End Function
|
|
|
|
|
One way is to specify the key & IV rather than generating them. Then you use the same values to decrypt.
e.g.
myRijndael.Key = keyBytes ' 32 bytes<br />
myRijndael.IV = ivBytes ' 16 bytes
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
I see. Do you have any example of how I can create these?
Can they be random (I mean different)?
Thanks,
|
|
|
|
|
Yep they're different.
One common way is to use the PasswordDeriveBytes class.
E.g. (in C#):
byte[] key = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(32);<br />
byte[] iv = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(16);
BTW those numbers are random. You can make up your own byte array. It's known as the salt .
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
Thanks man. I look into this. I found one way as you can see in my reply to another guy but would really like to finish what I've started.
Thanks again.
|
|
|
|
|
Hello My Dears............
I have downloaded "Network Sniffer & Connection Analyzer" code but get problem in running the code in "Microsoft Visual Studio 2005 Express Edition".....
PLZ Help me in running this code(Give details for running)..............Thanks.
khalid mahmood
|
|
|
|
|
hazarian wrote: Give details for running
How about giving details of what problem you are having?
|
|
|
|
|
This code consists of three Projects i-e "Port scanner,Sniffer,SnifferUI"......What should be the exact way of running these three projects.
khalid mahmood
|
|
|
|
|
Hi,
I've got a combobox to which I add objects.
I would like to have one specifiec object selected.
Some of the objects contain the same DisplayMember but differ in other aspects = index.
When the objects that do not have dublicates are selected there is no problem in selecting correct item as selected, but when the object has DisplayMember dublicates the first displayed items is always selected no matter what SelectedIndex or SelectedItem is assigned.
Any tip?
ToDo
|
|
|
|
|
I looked at DisplayMember under the ComboBox entry in MSDN for VS2005 and there was an example program (for ListBoxes) which I subtley changed to be a ComboBox. I also modified the sample data to contain duplicate DisplayMember values. It seems to work perfectly as far as I can tell, but maybe I am missing your point?
Just copy and paste all this code into a WindowsApplication.
HTH - Des
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace WindowsApplication3
{
public partial class Form1 : Form
{
//private ListBox ListBox1 = new ListBox(); // Just for our test
private ComboBox ListBox1 = new ComboBox();
private TextBox textBox1 = new TextBox();
public Form1()
{
this.ClientSize = new Size(292, 181);
this.Text = "ListBox Sample3";
ListBox1.Location = new Point(24, 16);
ListBox1.Name = "ListBox1";
ListBox1.Size = new Size(232, 130);
textBox1.Location = new Point(24, 160);
textBox1.Name = "textBox1";
textBox1.Size = new Size(240, 24);
this.Controls.AddRange(new Control[] { ListBox1, textBox1 });
// Populates the list box using DataSource.
// DisplayMember is used to display just the long name of each state.
ArrayList USStates = new ArrayList();
USStates.Add(new USState("Alabama", "AL"));
USStates.Add(new USState("Washington", "WA"));
USStates.Add(new USState("Washington", "W1")); // Duplicate DisplayMember
USStates.Add(new USState("West Virginia", "WV"));
USStates.Add(new USState("Wisconsin", "WI")); // Duplicate DisplayMember
USStates.Add(new USState("Wisconsin", "W1"));
USStates.Add(new USState("Wyoming", "WY"));
ListBox1.SelectedValueChanged += new EventHandler(ListBox1_SelectedValueChanged);
ListBox1.DataSource = USStates;
ListBox1.DisplayMember = "LongName";
ListBox1.ValueMember = "ShortName";
}
private void ListBox1_SelectedValueChanged(object sender, EventArgs e)
{
if (ListBox1.SelectedIndex != -1)
textBox1.Text = ListBox1.SelectedValue.ToString();
}
}
public class USState
{
private string myShortName;
private string myLongName;
public USState(string strLongName, string strShortName)
{
this.myShortName = strShortName;
this.myLongName = strLongName;
}
public string ShortName
{
get
{
return myShortName;
}
}
public string LongName
{
get
{
return myLongName;
}
}
public override string ToString()
{
return this.ShortName + " - " + this.LongName;
}
}
}
|
|
|
|
|
Hi,
thanks for the reply.
Try chaning this code part, I get the the first Washington selected.
// Populates the list box using DataSource.
// DisplayMember is used to display just the long name of each state.
ArrayList USStates = new ArrayList();
USState defaultSelection = new USState("Washington", "W1"); //New
USStates.Add(new USState("Alabama", "AL"));
USStates.Add(new USState("Washington", "WA"));
USStates.Add(defaultSelection); // Duplicate DisplayMember //Changed
USStates.Add(new USState("West Virginia", "WV"));
USStates.Add(new USState("Wisconsin", "WI")); // Duplicate DisplayMember
USStates.Add(new USState("Wisconsin", "W1"));
USStates.Add(new USState("Wyoming", "WY"));
ListBox1.SelectedValueChanged += new EventHandler(ListBox1_SelectedValueChanged);
ListBox1.DataSource = USStates;
ListBox1.DisplayMember = "LongName";
ListBox1.ValueMember = "ShortName";
ListBox1.SelectedItem = defaultSelection; //New
Regards,
ToDo
|
|
|
|
|
Now I see what you mean, I originally thought that no matter which of the duplicates you selected, you were only getting the object mapped to the first duplicate returned, but I think what you are saying is that when you go to the ComboBox, the selected object is the first of the duplicates in the list.
I haven't a way around this yet, but at least I now understand the problem.
|
|
|
|
|
Hello,
I'm new to .net 2.0 and have the following problem:
I have multiple tables in a MSSQL database.
I use DataGridViews to display or enter Data to this tables
Visual Studio has put some things automatically in:
DataSet<->BindingSource<->BindingNavigator<->TableAdapter<->DataGridView
I have the problem to find a starting point for doing something. I have added after
InitializeComponent();
a few lines to display the table.
try<br />
{<br />
this.xyzTableAdapter.Fill(this.testDataSet.xyz);<br />
}<br />
catch (System.Exception ex)<br />
{<br />
System.Windows.Forms.MessageBox.Show(ex.Message);<br />
}<br />
this.xyzDataGridView.Columns[0].DefaultCellStyle.Font = new Font(DataGridView.DefaultFont, FontStyle.Italic);<br />
Also I used the SaveItem_Click-event to save the data back to the database
<br />
try<br />
{<br />
this.Validate();<br />
this.xyzBindingSource.EndEdit();<br />
this.xyzTableAdapter.Update(this.testDataSet.xyz);<br />
}<br />
catch (System.Exception ex)<br />
{<br />
MessageBox.Show("Update failed" + ex.ToString());<br />
}<br />
This works, but i don't have a clue if this is the best method of doing this.
That is not the main problem.
What i really want are 2 thing:
I want to combine to tables in one DataFlexGrid.
Example:
One table may be car.
A car could have tires which are in another table.
So table "car" should contain a link to table "tire" as foreign key.
What i want in the DataGridView is a DataGridViewComboBox-column, where a user could just choose the "tire" for the "car" from.
Where I have problems doing this:
I have no starting point.
In the designer i can change the column value to DataGridViewComboBox. But I don't know how to fill the ComboBox (one other thing that i search is how to prefil cells if a new row is added, e.g. adding a new DateTime).
Selects could be written easy (Like SELECT car.carID, car.name, tire.name FROM car, tire WHERE car.tireID = tire.tireID or for the Combobox SELECT tire.name, tire.tireID FROM tire), but I don't know where to put these to.
The second problem would be the other was round: How could i alter the insert so that the tireID would be written to the car table?
Under DataSource "Edit DataSet with Designer" I could enter additional Insert Statements to the tableAdapter. But i have no clue how to use them. Whatever I do, they seem to be ignored.
Can anybody help? If there exists something like a tutorial or HowTo it would also help.
Regards
Wolfgang Schmidt
-- modified at 16:20 Thursday 23rd November, 2006
|
|
|
|
|
Have you found a solution to the problem?
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Yes, I did not find the data source properties for the dropdown the first time. Wanted to do it manually, but it is also fine using the designer
|
|
|
|
|
hi is there any way to run a batch file from c# application
hello
|
|
|
|
|
Hi,
you can launch all kinds of commands, including opening Word documents, or executing
DOS batch files, using the Process and StartInfo classes.
Put the batch file name into StartInfo.FileName, and optional arguments in StartInfo.Arguments.
Luc Pattyn
|
|
|
|
|
Does anyone have any links to resources that may help me. I've been asked to come up with a proposal for an intercom type system, LAN based only.
The problem over normal VOIP is that the voice communication is a simulation of radio traffic, so the users on system may all be on different channels, only when connected to the same channel can they communicate.
To simplify, I'm willing to have a limited number of preset channels which users can join/leave. When two or more people are on the same channel, they can talk to each other in a half-duplex method.
I was thinking about having a "server" machine and using some form of remoting allowing users to call a common Talk() method on a remote instance (thus allowing the blocking others from talking if required).
My questions really are related to the "streaming" of the transmit from the "talker" out to the "listener".
I should have time to do a good implementation, but need to present the posposal at the start of next week!
Any links, ideas would be welcome.
Regards,
Ray
|
|
|
|
|
Convinced there are good products out there! and probabely very cheap
|
|
|
|
|
~~~Johnny~~~ wrote: Convinced there are good products out there! and probabely very cheap
I'd love it if there were... and money isn't that big an object for the right product (it's an important component of an 8 figure project).
The latest spanner added to the design is that listeners need to be able to listen to multiple independant channels at the same time! I'm convinved we'll end up creating the framework but I'd still love an API/library to do the comms/audio side of things!
In the mean time, I'm presenting the solution without going into programming/implementation specifics -- since that is actually inappropriate at this early stage of my project!
Regards,
Ray
|
|
|
|
|
hi
Is there any way that we could shut down and restart our system through our c# applicaiotn ? thanks in advance
hello
|
|
|
|
|
Use this :-
System.Diagnostics.Process.Start("Shutdown", "-s ");
To know more about other command write shoutdown /? at command prompt.
Regards,
Bhupi Bhai.
|
|
|
|
|
Thanks
but this code goes into abnormal execution ,, forms statrs opening countless
so amazing ,, why is that? i am using dont net v 2
thanks in advance
hello
|
|
|
|
|
It can probably be done through API calls. I know their are methods that allow you to show the ShutDownDialog. Try looking for API Guide and API Viewer on Google, and look through their listing of API commands.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi all
I have a c# application which sends a singnal through com port on some device attatched on the local system com port , every thing goes ok when i run this application from the local system (workgroup)and i can send and receive singal from local system's com port,, but the problem is that when i run this application on a system which is client of a central server(win2003 server) , it doesnot detect device on its local com port it searches device on the com port of server computer and because there is no device on the com port of remote server so my application does not work , thoug it is network isuue ,, but any idea > what to do ?
thanks in advance
hello
|
|
|
|
|