simplify logic in Utils::secureText() by using a lambda