From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A138B4C267 for ; Thu, 6 Feb 2025 12:39:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D51ED68BBE5; Thu, 6 Feb 2025 14:38:57 +0200 (EET) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7486B68BB1E for ; Thu, 6 Feb 2025 14:38:51 +0200 (EET) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53e3a37ae07so979264e87.3 for ; Thu, 06 Feb 2025 04:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1738845530; x=1739450330; darn=ffmpeg.org; h=mime-version:references:message-id:in-reply-to:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=/8w0f8BX3V3HlLnVrQQakCSwT9GjEyt+ZILWQcpNYj0=; b=qHgXuavX0JHOuMkZSpo+l1I0ujrHNAN4DGAZoOIYtyPDoiBZZbSpMSGR9uHqCmr/nE mtz3dFqK1l1aotgJMXQ/FhEk55ZWVV/WnEiXpGHQZ6dz2UeZSYRcAlyemzpplRnpWUm8 yQstzmv9VV7i+4e6QyPNcpfz08EIRMO/vCEwuGq67igvuYsRhnGoEJM52Htj9xwsb7eB l7myfRL35Yq8V59UC40TFPhbHZ3ISvwbCWk32CYCJCSi9ybYdlhm7DmXryYd+Qxfyuig b37nw0ZpU0soQDrsBG+FKGS1qaioTl9PHFLY7pbpqZkzC8DhpWMwJwsuK0oBFN4vqkHN W68A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738845530; x=1739450330; h=mime-version:references:message-id:in-reply-to:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/8w0f8BX3V3HlLnVrQQakCSwT9GjEyt+ZILWQcpNYj0=; b=U5LX8nJRRnIllSiTE8fLkDheSacU+8fKgvfzXaFHAFZavTcobPtBbw8uoCCdJeqggP FPHtADNq077lzFjTysjrrpdPMZiroJvf2JtkBwHDw0ebKLD4nvmQFQbbdPBEZwSv+yUy h1tobHErBRuTEKQKHqTLg04F7GAT5hjRe/7Qb7onMauU4fqHb3FTgx6n2SV32QD9sEll 5hNIrktStziwBgZF4i7vNAvn3dPQoYT+rXQgwFjy6irgNNe82qmlIDCDJsGhGzFJh1zi y7/3fhRmyqlSqq1UqIPMKRQNughK0wvNd9E2U3N/uWu1jaJlf1KOwOIbNELJUeL7NBdP XWeQ== X-Gm-Message-State: AOJu0Yxb9PZ4YtPYfJIlIWKqUUCdFbzRAHM30jTijfPM1bsvONVJkZg9 pUFfloz0yJ9rYo0RbmsvtQCdxuC5xXP2YTP6huW8IT6C8fEL1KPqbm01NKdunOeeq1sYFE8uxNc 8tQ== X-Gm-Gg: ASbGncs9rX9yqlgzN9p/X+9usvZNnJMnW7W7LLIg5L2JPWs4P39G6gk0fIcSZG/dtdG DotDFNhlLTLQdDdXLn0YDRdEKEKFVBbHOAiy3wML6gle+AjiqmH2B71eaQu8U7LkZmsvR+T1Ecy +V24ZgE3ev0CJa8kQUnKvNIqNTTOe4xok78smCNfGcfWy25JI0tiNoTntRjQPTQGD6+ruOuVj+L yBW8sa45MpiC4VZ9ayc93xIeHQZ+81mRHTh0v10o6QRBxjpObi9/fc4d+l1MMljlVXODWDlDa8I 9029wdC8r76lSjQZ6dfo/6gc3sJggx3HTxHBZuS2PwVANb8Z+RhAFOIHST/WKGImyXPMX+2prel llDT0r+NxNhA= X-Google-Smtp-Source: AGHT+IEizdQMEI+roXHlC+P1tJVzIBGZNsRsD0LbuUtcBIWQ/M4R09QD46wA9dHirFDpWs7YbM18Tg== X-Received: by 2002:ac2:4c56:0:b0:542:29a6:a063 with SMTP id 2adb3069b0e04-54405a718a9mr2608556e87.43.1738845530165; Thu, 06 Feb 2025 04:38:50 -0800 (PST) Received: from tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net (tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:11::2]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54410554144sm122116e87.57.2025.02.06.04.38.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 04:38:49 -0800 (PST) Date: Thu, 6 Feb 2025 14:38:48 +0200 (EET) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <20250206001638.GI4991@pb2> Message-ID: References: <20250205221813.4110398-1-martin@martin.st> <20250205221813.4110398-2-martin@martin.st> <20250206001638.GI4991@pb2> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] random_seed: Improve behaviour with small timer increments with high precision timers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 6 Feb 2025, Michael Niedermayer wrote: >> + // If the timer resolution is high, and we get the same timer >> + // value multiple times, use variances in the number of repeats >> + // of each timer value as entropy. If the number of repeats changed, >> + // proceed to the next index. > > Does it still work if you check against the last 2 ? > or does this become too slow ? > What iam thinking of is this > > 7,8,7,8,8,7,8,7,8,8,7,8,7,8,8,7,8,7,8,8,... and a 9 or 6 or further distant would trigger it > > I assume both the CPU clock and the wall time are quite precisse so if we > just compare them the entropy could be low even with 2 alternating values Yes, that still works for making it terminate in a reasonable amount of time. I updated the patch to keep track of 3 numbers of repeats, and we consider that we got valid entropy once the new number of repeats is different from the last two. So in the sequence above, e.g. for 7,8,7,8,8,7, at the point of the last one, we have old repeats 8 and 8, and the new repeat count 7, which in that context looks unique. It's obviously not entirely unique in the wider context there, but it should cover for cases when we alternate between two numbers at least. It's of course not hard to make it look at an even longer history, although the conditional becomes a bit more unwieldy in that form. // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".