Ah right i started like that at first but somebody said somthing different. So still stuck. If the salt is randomly generated then how can i hash/salt the password then compare? The password has been hashed to md5 but the salting i can't do. Any ideas? Thanks for your time Dave.
malcomhfc
Posts
-
retrieve the salt from a mysql database for a password. [modified] -
retrieve the salt from a mysql database for a password. [modified]Ok. Thanks for replying. It's really annoying me. Im trying to think and it's like when you get writers block. Theres nothing there. Like a head of compressed air.
-
retrieve the salt from a mysql database for a password. [modified]Ive been researching for ages but maybe this can help anyone. Similar than above and kind of helps me in away.
$part = explode(":",$password);
$salt = $part[1];
$encrypted_password = md5($mypassword . $salt).":".$salt;
;So maybe it works by making my vb.net app read the database, get the password and split the password into 2 parts with the :(colon) in the password. Then encrypt the password and add the salt to the password. However now i think i have the theory, i have no idea how to implement it correctly. Can anyone give a basic example instead please? Any help is great appreciated, Robbie.
-
retrieve the salt from a mysql database for a password. [modified]Sorry i should explain better. When you register a new user with joomla it adds a randomly generated salt to the md5 password. so the password in the password field looks like hash:salt (seperated by a colon in the database) I think this php code helps. I don't know php that well but well enough to read it.
<form action='login.php' method='post' name='login'>
<b>User:<b> <input type=text name='username' maxlength=15 width=18><br/>
<b>Password:<b> <input type=password name='password' maxlength=15 width=18><br/>
<input type=submit value='Login'>
</form><?php
$dbaddress='localhost'; $dbuser='root'; $dbpass='root'; $dbname='yourdatabase';$dbcnx = mysql_connect($dbaddress,$dbuser,$dbpass)
or die("Could not connect: " . mysql_error());
mysql_select_db($dbname, $dbcnx) or die ('Unable to select the database: ' . mysql_error());$query = mysql_query("select password from jos_users where username = \"" . $_POST["username"] . "\"")
or die("Unable to validate login and password with the database:" . mysql_error());$result = mysql_fetch_array($query);
$result = $result[0];
$parts = explode( ':', $result);// Check if password is md5-ed with or without salt if (count($parts) < 2) $new\_password = md5($\_POST\["password"\]); else { $salt = $parts\[1\];
// convert the raw password to md5(password+salt):salt model
$new_password = md5($_POST["password"] . $salt) . ":" . $salt;
}
if ($new_password != $result)
{
echo "no login"; // your params
}
else
{
echo "successful validation"; // your params
}
?>Thanks for replying, Robbie.
-
retrieve the salt from a mysql database for a password. [modified]Hi there. I have a login on my vb.net application. It is using the Joomla database for user management and integration to my website. However i have hit a problem. The joomla passwords are hashed as MD5 and salted with 32 characters. It looks like this hashpassword:salt The colon splits the password with the salt. Im just struggling to find out how to retrieve the salt and append it to the password. So far i have this:
Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlogin.Click
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As MySqlDataReader
'txtEmail.Text.Replace("'", "\'") BoxPassword.Text.Replace("'", "\'")
Dim SQL As String
'Our MySQL Query
Dim Email As String = TxtEmail.Text.Replace("'", "\'")
Dim password = (getMD5Hash(BoxPassword.Password + ":"))
SQL = "SELECT * FROM `jos_users` WHERE `username` = '" + Email + "' AND `password` = '" + Password + "'"Label1.Content = BoxPassword.Password myCommand.Connection = conn myCommand.CommandText = SQL myAdapter.SelectCommand = myCommand Try 'Try to execute the query myData = myCommand.ExecuteReader() myData.Read() If myData.HasRows = 0 Then 'Checkes if a row with the email and password exist. 'If no outputs this: notifyicon.ShowBalloonTip(3000, "Warning User", "The Email Address and Password that you entered dont match!", Avalon.Windows.Controls.NotifyBalloonIcon.Warning) Txtwrongpass.Content = "The Email Address and Password that you entered dont match!" myData.Close() Else 'if yes outputs this: 'notifyicon.ShowBalloonTip(3000, "Welcome " + myData.GetString("fname") + " " + myData.GetString("lname"), "You have sucessfully logged into RemindMe", Avalon.Windows.Controls.NotifyBalloonIcon.Warning) Dim loPage1 As New user loPage1.Background = Brushes.Gray Me.Content = loPage1 myData.Close() End If Catch ex As MySqlException 'If fail outputs MySQL Error MsgBox(ex.Message) End Try End Sub
As you may see if have hashed the password with md5 and attached the ":" colon but i dont know how to retrieve the password. Any help would be gr
-
Optimising part of a code thats bulkyAh great modified it to my liking. Much shorter and more readable :D Thank you a lot. Sorry for my late reply was back to college this week. :(
-
Optimising part of a code thats bulkyHi there. I'm continuing to learn c# but moved on to the .net 4 compact framework. I have this piece of code i am using in a project. All though it does what i want it too, it feels to clunky and no need for multiple methods. I just don't know how to optimize it. I am trying to get it to do everything in the responsehandler, without the need for 3 of the same methods. It means my code wont be clunky and unoptimized and i believe all the feeds with display at once and not at different times.
/* removed, no need for it here i think */ but fyi its using system.xml and system.servicemodel.syndication --typo
namespace NewsTap
{
public partial class NewsFeed : PhoneApplicationPage
{
object _selectedItem;
public NewsFeed()
{InitializeComponent(); SupportedOrientations = SupportedPageOrientation.Portrait; Loaded += new RoutedEventHandler(MainPage\_Loaded); PageTransitionList.Completed += new EventHandler(PageTransitionList\_Completed); // Set the data context of the listbox control to the sample data //DataContext = new MainViewModel(); string bbc = "http://www.pchelpforum.com/external.php"; string dailyMail = "http://www.dailymail.co.uk/home/index.rss"; string guardian = "http://www.guardian.co.uk/tv-and-radio/rss"; //bbc request HttpWebRequest bbcRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(bbc)); bbcRequest.BeginGetResponse(new AsyncCallback(ResponseHandler), bbcRequest); //daily mail request HttpWebRequest DailyMailRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(dailyMail)); DailyMailRequest.BeginGetResponse(new AsyncCallback(ResponseHandlerdaily), DailyMailRequest); // Guardian request HttpWebRequest GuardianRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(guardian)); GuardianRequest.BeginGetResponse(new AsyncCallback(ResponseHandlerguardian), GuardianRequest); //Custom request -- coming soon } private void MainPage\_Loaded(object sender, RoutedEventArgs e) { // Reset page transition ResetPageTransitionList.Begin(); } #region getting feed private void ListBbc\_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { // Capture selected item data
-
Media StreamingThank you both, ill take a look into the links you have posted :)
-
Media StreamingI am wanting to make a desktop application to go along with my website. The idea is to display all media mainly movie files in the desktop application and be able to stream them. I will be using a MYSQL database and a login system which I have already setup. Could anyone help me on how I would go about displaying and streaming media content. For example how adobe media player does it but of course on a much smaller scale. Snippet codes or ways of doing it would be great please. If you give me snippet codes, just display the main points, then i can build on it. :) Thank you for any help received, Robbie.
-
having a login in a windows form that uses a remote MySql databaseThanks for the reply, the tutorial looks very helpful. Just about to go read it ;)
-
having a login in a windows form that uses a remote MySql databaseI am learning visual basic, i have asked questions before and got great answers and oping for a little bit of help again if no one is busy :) I am a trainee web designer/developer and have my own website, which i am currently designing. Now i have planned it all out and wish to create a Visual Basic.NET program. I wish for both the website and the program to have the same logins, both using a MySql database. The website is using a simple script by me for the login at the moment. I didn't want to over complicate it, till i have the Vb program connecting to the database too. Heres a simple breakdown: 1. Both website and program use same login credentials and same MySql database. 2. Visual Basic program connect remotely to the Mysql database. ( with a shared host ) The program would go about it by basicly starting with a mysql connection then, accessing both username and password tables and checking is Username.TEXT & Password.TEXT match with the database. Once matches, then load up Mainfrm Sorry for the big message. I have did research on how i would go around doing this. Nothing i can find suggests how i could connect to a remote database on a shared host with (cPanel) Some of the code im using just now to open the connection, but not sure how to connect to my databse :
Dim connect As New MySqlConnection Dim sqlcommands As New MySqlCommand Dim myConnString As String Dim UserID As Integer myConnString = "server=" & My.Settings.HostIP & ";" \_
My.Settings.HostIP - code i have put in settings file all it contains is my website which doesn't work, of course hehe XD I have the import mysql client. Any help would be great thanks. Ofc im not asking someone to do all the work, just asking for some help or ways to improve what i have.
-
writing a timestamp to a xml file.Thank you both. I tried your hints and i got somewhere. Just was hitting a wall. The time was coming out as 00:00:00. To the last replier before me, thanks for the code, really gave me a better idea of what i needed. Thanks :D
-
writing a timestamp to a xml file.Oki sorry, i asked wrong, i have tried some ways but i can't get it to work. Im not asking for the answer, that be wrong. I am learning it afterall. I just need say a boost. Just a quick example of generating a timestamp then i can work it from there. I did some googling and believe i can easly use xml file just need to mess around abit more. Sorry for the bother, Malcom
-
writing a timestamp to a xml file.Hey all. On a new project im working on, which is about learning different areas in visual basic. One area i havnt covered much is writing to files and retrieving data from a file. The program includes a update script, which justs checks online reading a .txt file to see if the version is newer, if so it downloads it. I would like to record when the user last press 'checkForUpdates' button. Take the timestamp and write it into a xml file. Then using a simple label to read and display the value inside the xml file. I have been trying a few ways, just using timestamps i got lost. Any help would be great, Malcom
-
nested if statementAh right ofc makes sense i was missing out End If and you explain very good. Thanks :)
-
nested if statementIve had a google about nexted if statements but failing to find what i need, or just am not awake to find it :laugh: So here is an example of what i need help with
if textbox1.text = "example" then
if textbox2.text = "another example then
so on.....END IF
I have done it it java just not sure in VB, in a quick way, when system runs the if statement, if the first if passes then go onto the second if statement. Could anyone help me out on the correct syntax?
-
Take data from a website and display in a program.Thanks for the help :)
-
Take data from a website and display in a program.Yeah i have heard of HttpRequest and Response. I didn't want to use a browser. So on return of the data it is possible to display it differently. For example come up in a textbox or different controls im not really thinking of just now. Thanks for the book recommendation, i'm looking for the best one at Amazon :)
-
Take data from a website and display in a program.So i've slowly been learning c# over few months but going slow and is my first language. One thing i would like to know, is how it would get a c# program to take data from a website then display inside the application. (Not taking data from a database) Could anyone possible point be at examples or tell me roughly what i would have to do. Thanks in advance, Malcom
-
Hi there. Looking for help on a vb project.Thanks for replying, i managed to get help. Thanks again, Malcom