public static function encrypt($plaintext, $password, $cost = 0)
{
// Generate IV of appropriate size.
$iv = Random::bytes(self::IVSIZE);
// Derive key from password
$key = self::key($password, $iv, $cost, self::RIJNDA, self::mode());
// Encrypt the plaintext
$message = \openssl_encrypt($plaintext, static::CIPHER, $key, 1, $iv);
// Create the cypher text prefix (iv + checksum)
$prefix = $iv . self::checksum($message, $iv, $key, self::RIJNDA, self::mode());
// Return prefix + cyphertext
return $prefix . $message;
}