Snippet to generate an encoded password for Silex/Symfony usage
$username = "admin";
$password = "pass1234";
$factory = $app['security.encoder_factory'];
$user = new \Symfony\Component\Security\Core\User\User($username, $password);
$encoder = $factory->getEncoder($user);
$encodedPassword = $encoder->encodePassword($password, $user->getSalt());