- Joined
- Sep 28, 2005
- Messages
- 1,226
- Reaction score
- 66
Since you cant switch strings in java..someone made a funny bypass
(found it on worsethanfailure )
the orginal version
Attention: Some Strings can have the same hashcode but overall it should be secure to use this
(found it on worsethanfailure )
Code:
int helpArg = getHashValue("help");
int singleArg = getHashValue("single");
int mutiArg = getHashValue("multi");
public static void main (String args[])
{
// Get a hash value for the first argument
int hash = getHashValue(args[0].toCharArray());
switch(hash)
{
case helpArg:
...
break;
case singleArg:
...
break;
case mutiArg:
...
break;
// etc
}
}
the orginal version
Code:
public static void main (String args[])
{
// Get a hash value for the first argument
int hash = getHashValue(args[0].toCharArray());
switch(hash)
{
case 972346: // The first argument was "help"
...
break;
case -91058: // The first argument was "single"
...
break;
case -4830672: // The first argument was "multi"
...
break;
// etc
}
}
Attention: Some Strings can have the same hashcode but overall it should be secure to use this