In PHP a magic hash attack happens when loose type comparisons cause completely different values to be evaluated as equal, causing a password "match" without actually knowing the password. Here is an example:
<?php
if (hash('md5','240610708',false) == '0') {
print "'0' matched " . hash('md5','240610708',false);
}
If you execute this you will see:
'0' matched 0e462097431906509019562988736854
Would this be possible in a JavaScript application that's using using the loose equality ==
operator to compare two hashes?
JavaScript is a weakly typed language, so I would naturally assume the type coercion can be taken advantage of and therefore present various security holes.