Improve the comparator function

Previously the length check first would cause it to bail out
earlier if the password differenciated in length

Change-Id: Id75c9689777730f1dee915526f53a140481a11b1
Reviewed-on: http://review.couchbase.org/32357
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Aaron Miller <apage43@ninjawhale.com>
Tested-by: Aaron Miller <apage43@ninjawhale.com>