[Cryptography] quantum computers & crypto
Ray Dillinger
bear at sonic.net
Mon Nov 8 20:06:57 EST 2021
On 11/8/21 11:31 PM, Christian Huitema wrote:
>
> On 11/8/2021 1:00 PM, Ray Dillinger wrote:
>>
>> But if you do 52 perfect shuffles in a row you bring the deck back into
>> its original order. No matter what (n) you use, it will never be 'more
>> secure' than some (n) less than 52. The so-called 'perfect shuffle' is
>> actually fairly lousy considered as a randomization algorithm, but you
>> see the point.
>
> Really? Did you mean to write 52! perfect shuffles in a row?
>
Nope. It's only 52. Closed cycles of a single operation within a group
tend to be very short on average. 52! is absolutely the longest a state
cycle could be, 52 is "typical" for most repeated operations.
No need to take my word for it though: Try it yourself! I'm just
eyeballing this but I bet it'll compile:
int main(int argc, char **argv){
int deck1[52]; int deck2[52]; int count; int shuffle;
for (count = 0;count<52;count++)deck1[count]=count;
for (shuffle=count=0; shuffle<52; shuffle+=(++count==52),count=count%52)
(shuffle%2?deck1:deck2)[count]=(shuffle%2?deck2:deck1)[count/2+count%2?0:26];
for (int count = 0; count<52;count++) if (deck1[count]!=count) break;
printf(count==52?"succeeded.\n":"failed.\n");
}
Bear
More information about the cryptography
mailing list