Since you cant switch strings in java..someone made a funny bypass
(found it on worsethanfailure )
the orginal versionCode: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 } }
Attention: Some Strings can have the same hashcode but overall it should be secure to use this :)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 } }



Reply With Quote![[Java] Switch on Strings in Java ^_^](http://ragezone.com/hyper728.png)

