|
Not only is MD5 deprecated in favour of more secure algorithms, it's a hashing algorithm, not an encryption algorithm. There is no "password", and you cannot "decrypt" the hashed value.
But that's a good thing, because you should never be able to decrypt the user's password. To validate that the user has entered the correct password, you just apply exactly the same hashing algorithm to the entered password, and compare the result to the stored hash value.
Salted Password Hashing - Doing it Right[^]
As for doing the hashing on the client side, that's a very bad idea. Anyone who can sniff the network traffic doesn't need to know the original password to impersonate the user; they can just submit the hashed password instead.
Set up an SSL certificate on your site, and ensure that your login page is only ever served over HTTPS. That way, the infrastructure will protect the password in-flight, and you can do your salted password hashing on the server, where it belongs.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am currently working on an Android application (my first) and I am trying to add the licensing code that I use for all my other applications. The issue I have run into is that all my other programs were written in VB.NET and there is a hashing function that uses UInteger . I recently discovered that Java doesn't have unsigned integers so my hash function in Android is failing to give the same results as my .NET equivalent. Unfortunately I've used this code in too many projects to go change the hashing routine in all my other applications. The issue is occurring in this piece of code:
for(byte b : uniBytes){
hash += b;
hash += (hash << 10); <--This returns negative numbers
hash ^= (hash >>> 6);
}
I tried implementing some logic so that after every operation the code would check if the hash variable was negative and if so convert it to a long such as long lngHash = 0xFFFFFFFFL & hash; , and I understand why it must be converted to a long. However, after a few more operations the hash would start to become incorrect again. I am assuming this is because if the number reaches a range that can fit into an integer, I must convert the number back to an integer in the same way when it grew I needed to convert it to an long.
I have even tried some open source libraries but they didn't support the shift operators. Any suggestions or insights into this? Am I at least on the right track with having to convert the hash back and forth between an integer and long as need? Any help or guidance of how to get this method to work is greatly appreciated. Thanks.
A black hole is where God tried to divide by zero.
There are 10 kinds of people in the world; those who understand binary and those who don't.
|
|
|
|
|
import java.util.*;
public class Vector {
int x,y;
int value;
public Vector(int i, int j) {
x=i;
y=j;
}
Vector vectorPlus(Vector v) {
return new Vector(x+v.x,y+v.y);
}
public size(){
value=Pow(x,2)+Pow(y,2);
}
public String toString() {
return "("+x+","+y+")";
}
public static void main(String[] args) {
Vector bordar= new Vector();
System.out.println("che tedad bordar mikhahid az vorodi begirid?");
Scanner scanner=new Scanner(System.in);
int tedad=scanner.nextInt();
for(int i=1;i<=tedad;i++)
{
//i should type some code
}
}
}
|
|
|
|
|
1) It is not in a preformatted block;
2) We know nothing of what it should do;
3) We know nothing of what it is doing that it shouldn't do.
|
|
|
|
|
Member 11251031 wrote: //i should type some code Well, at least that part is correct. Now perhaps you could explain what your problem is.
|
|
|
|
|
hi
how can i write 15 puzzle
no using back track
computer solve it not user
i know if it can be solved it happen in 80-85 move ...
i need the codes
|
|
|
|
|
Have you tried searching the articles here on CP?
|
|
|
|
|
|
This does not make any sense.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am trying to launch a GUI to my agent-based model (Repast) so that being able to run the model for many times. I am going to produce input parameters based on different distributions for different runs from GUI. Usually we should use batch file for different runs. However, I want to use GUI for this reason because I have GUI that can take care for one run but not for many runs. Could you help me with your idea in this respect?
|
|
|
|
|
Member 11245527 wrote: Could you help me with your idea in this respect? Idea for what, you have not explained what your problem is?
|
|
|
|
|
If you normally use batch files to do many runs then in your GUI just use a ListBox and that can store all the runs you need to do.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I Get dataset of neighbours using kNN and then I want to apply k-mean on that dataset. By using this, is it possible that I get more accurate result? Is it logically correct that use kNN and then after use k-mean or vice-versa?
|
|
|
|
|
|
String strInsert = "INSERT INTO suppliers_stock VALUES (? ,? , ?, ?)";
I can't insert value into the database. I am trying to insert value into the bridge entity table, but it doesn't work. Anyone can tell me what is the problem?
|
|
|
|
|
Because that form isn't supported. You'll need to list the columns
INSERT INTO suppliers_stock ( ... ) VALUES (? ,? , ?, ?)
|
|
|
|
|
|
jdzgray wrote: String strInsert = "INSERT INTO suppliers_stock VALUES (? ,? , ?, ?)";
I can't insert value into the database. I am trying to insert value into the bridge entity table, but it doesn't work
Besides the other comment you might note the difference in the above two statements as well.
|
|
|
|
|
a constrain may prevent it. Provide information about the table structure as well as the data you are trying to insert.
|
|
|
|
|
hi,
I am using Jdeveloper. when i make connection between Jdeveloper and MS Access it connects and i can see all my table in jdeveloper editor. but when i run my page it did not displays any thing.
Any help.
|
|
|
|
|
Tufail Ahmad wrote: but when i run my page it did not displays any thing. Sorry, but we cannot guess what may be happening in your program. Please show the failing code and explain exactly what is happening.
|
|
|
|
|
Tufail Ahmad wrote: Any help.
Some possibilities and there are others.
1. You are not using the connection
2. You are eating exceptions
3. You querying empty tables
4. You are not querying correctly thus no rows are returned
5. You are not populating your UI entities correctly
6. Your code isn't even running the database part so the UI part can't be populated.
|
|
|
|
|
import java.util.Scanner;
public class ses
{
public static void main(String args[])
{
int i=0, n=0,p=0,j;
Scanner s=new Scanner(System.in);
p=1;
while(n!=p)
{
System.out.print("Enter a numbner");
n=s.nextInt();
if(p==1 &&n==p)
break;
for(j=2;j<=n/2;j++)
{
if(((i%j)==0)&& j!=1)
{
p=0;
break;
}
}
}
}
}
I want that program accept valeus from user until a prime number is pressed but there is a problem in that code it don`t stop after entering three or two value .
|
|
|
|
|
That would be much easier to read if it were formatted consistently.
It appears that you are using p as a boolean: 1=prime , 0=non-prime So why test while(n!=p) and &&n==p ?
Also, why test && j!=1 when j will never be 1 ?
for(j=2;j<=n/2;j++) I would also test for p!=0 and remove the break
Also, you need only iterate until you reach the square root of n .
i%j It appears that i is always 0 .
I wouldn't use an if to test the division/modulo, I'd just set p
P.S. You need to reinitialize p on each loop.
modified 13-Nov-14 11:51am.
|
|
|
|
|
Try:
public static void main(String args[])
boolean p = true;
int number;
int j;
Scanner s=new Scanner(System.in);
while(p) {
System.out.print("Enter a number");
number = s.nextInt();
if (number < 2)
break;
for(j = 2; j <= number / 2; j++) {
if (number % j == 0) {
break;
}
}
if (j >= number / 2) p=false;
}
}
[edit]
Modified thanks to advice by PIEBALDconsult[^].
[/edit]
modified 13-Nov-14 11:23am.
|
|
|
|