Читаем Cryptonomicon полностью

Solitaire generates a keystream using a deck of cards. You can think of a 54-card deck (remember the jokers) as a 54-element permutation. There are 54!, or about 2.31 x 10^71, possible different orderings of a deck. Even better, there are 52 cards in a deck (without the jokers), and 26 letters in the alphabet. That kind of coincidence is just too good to pass up.

To be used for Solitaire, a deck needs a full set of 52 cards and two jokers. The jokers must be different in some way. (This is common. The deck I'm looking at as I write this has stars on its jokers: one has a little star and the other has a big star.) Call one joker A and the other B. Generally, there is a graphical element on the jokers that is the same, but different size. Make the "B" joker the one that is "bigger." If it's easier, you can write a big "A" and "B" on the two jokers, but remember that you will have to explain that to the secret police if you ever get caught.

To initialize the deck, take the deck in your hand, face up. Then arrange the cards in the initial configuration that is the key. (I'll talk about the key later, but it's different than the keystream.) Now you're ready to produce a string of keystream letters.

This is Solitaire:

1. Find the A joker. Move it one card down. (That is, swap it with the card beneath it.) If the joker is the bottom card of the deck, move it just below the top card.

2. Find the B joker. Move it two cards down. If the joker is the bottom card of the deck, move it just below the second card. If the joker is one up from the bottom card, move it just below the top card. (Basically, assume the deck is a loop . . . you get the idea.)

It's important to do these two steps in order. It's tempting to get lazy and just move the jokers as you find them. This is okay, unless they are very close to each other.

So if the deck looks like this before step 1:

3AB89

at the end of step 2 it should look like:

3A8B9

If you have any doubt, remember to move the A joker before the B joker. And be careful when the jokers are at the bottom of the deck.

3. Perform a triple cut. That is, swap the cards above the first joker with the cards below the second joker. If the deck used to look like:

246B4871A39

then after the triple cut operation it will look like:

39B4871A246

"First" and "second" jokers refer to whatever joker is nearest to, and furthest from, the top of the deck. Ignore the "A" and "B" designations for this step.

Remember that the jokers and the cards between them don't move; the other cards move around them. This is easy to do in your hands. If there are no cards in one of the three sections (either the jokers are adjacent, or one is on top or the bottom), just treat that section as empty and move it anyway.

4. Perform a count cut. Look at the bottom card. Convert it into a number from 1 through 53. (Use the bridge order of suits: clubs, diamonds, hearts, and spades. If the card is a (club), it is the value shown. If the card is a (diamond), it is the value plus 13. If it is a (heart), it is the value plus 26. If it is a (spade), it is the value plus 39. Either joker is a 53.) Count down from the top card that number. (I generally count 1 through 13 again and again if I have to; it's easier than counting to high numbers sequentially.) Cut after the card that you counted down to, leaving the bottom card on the bottom. If the deck used to look like:

7 ... cards ... 45 ... cards ... 89

and the ninth card was the 4, the cut would result in:

5 ... cards ... 87 ... cards ... 49

The reason the last card is left in place is to make the step reversible. This is important for mathematical analysis of its security.

5. Find the output card. Look at the top card. Convert it into a number from 1 through 53, in the same manner as above. Count down that many cards. (Count the top card as number one.) Write the card after the one you counted to on a piece of paper. (If you hit a joker, don't write anything down and start over again with step 1.) This is the first output card. Note that this step does not modify the state of the deck.

915

6. Convert the card to a number. As before, use the bridge suits to order them: From lowest to highest, we have clubs, diamonds, hearts, and spades. Hence, A(clubs) through K(clubs) is 1 through 13, A(diamonds) through K(diamonds) is 14 through 26, A(hearts) through K(hearts) is 1 through 13, and A(spades) through K(spades) is 14 through 26.

That's Solitaire. You can use it create as many keystream numbers as you need.

I know that there are regional differences in decks of cards, depending on the country. In general, it does not matter what suit ordering you use, or how you convert cards to numbers. What matters is that the sender and the receiver agree on the rules. If you're not consistent you won't be able to communicate.

<p><strong>KEYING THE DECK</strong></p>
Перейти на страницу:

Похожие книги

Аччелерандо
Аччелерандо

Сингулярность. Эпоха постгуманизма. Искусственный интеллект превысил возможности человеческого разума. Люди фактически обрели бессмертие, но одновременно биотехнологический прогресс поставил их на грань вымирания. Наноботы копируют себя и развиваются по собственной воле, а контакт с внеземной жизнью неизбежен. Само понятие личности теперь получает совершенно новое значение. В таком мире пытаются выжить разные поколения одного семейного клана. Его основатель когда-то натолкнулся на странный сигнал из далекого космоса и тем самым перевернул всю историю Земли. Его потомки пытаются остановить уничтожение человеческой цивилизации. Ведь что-то разрушает планеты Солнечной системы. Сущность, которая находится за пределами нашего разума и не видит смысла в существовании биологической жизни, какую бы форму та ни приняла.

Чарлз Стросс

Научная Фантастика
Дневники Киллербота
Дневники Киллербота

Три премии HugoЧетыре премии LocusДве премии NebulaПремия AlexПремия BooktubeSSFПремия StabbyПремия Hugo за лучшую сериюВ далёком корпоративном будущем каждая космическая экспедиция обязана получить от Компании снаряжение и специальных охранных мыслящих андроидов.После того, как один из них «хакнул» свой модуль управления, он получил свободу и стал называть себя «Киллерботом». Люди его не интересуют и все, что он действительно хочет – это смотреть в одиночестве скачанную медиатеку с 35 000 часов кинофильмов и сериалов.Однако, разные форс-мажорные ситуации, связанные с глупостью людей, коварством корпоратов и хитрыми планами искусственных интеллектов заставляют Киллербота выяснять, что происходит и решать эти опасные проблемы. И еще – Киллербот как-то со всем связан, а память об этом у него стерта. Но истина где-то рядом. Полное издание «Дневников Киллербота» – весь сериал в одном томе!Поздравляем! Вы – Киллербот!Весь цикл «Дневники Киллербота», все шесть романов и повестей, которые сделали Марту Уэллс звездой современной научной фантастики!Неосвоенные колонии на дальних планетах, космические орбитальные станции, власть всемогущих корпораций, происки полицейских, искусственные интеллекты в компьютерных сетях, функциональные андроиды и в центре – простые люди, которым всегда нужна помощь Киллербота.«Я теперь все ее остальные книги буду искать. Прекрасный автор, высшая лига… Рекомендую». – Сергей Лукьяненко«Ироничные наблюдения Киллербота за человеческим поведением столь же забавны, как и всегда. Еще один выигрышный выпуск сериала». – Publishers Weekly«Категорически оправдывает все ожидания. Остроумная, интеллектуальная, очень приятная космоопера». – Aurealis«Милая, веселая, остросюжетная и просто убийственная книга». – Кэмерон Херли«Умная, изобретательная, брутальная при необходимости и никогда не сентиментальная». – Кейт Эллиот

Марта Уэллс , Наталия В. Рокачевская

Фантастика / Космическая фантастика / Научная Фантастика
Лунная радуга
Лунная радуга

Анна Лерн "Лунная радуга" Аннотация: Несчастливая и некрасивая повариха заводской столовой Виктория Малинина, совершенно неожиданно попадает в другой мир, похожий на средневековье. Но все это сущие пустяки по сравнению с тем, что она оказывается в теле молодой девушки, которую собираются выдать замуж... И что? Никаких истерик и лишних волнений! Побег - значит побег! Мрачная таверна на окраине леса? Что ж... где наша не пропадала... В тексте есть: Попаданка. Адекватная героиня. Властный герой. Бытовое фэнтези. Средневековье. Постепенное зарождение чувств. Х.Э. В тексте есть: Попаданка. Адекватная героиня. Властный герой. Бытовое фэнтези. Средневековье. Постепенное зарождение чувств. Х.Э. \------------ Цикл "Осколки миров"... Случайным образом судьба сводит семерых людей на пути в автобусе на базу отдыха на Алтае. Доехать им было не суждено, все они, а вернее их души перенеслись в новый мир - чтобы дать миру то, что в этом мире еще не было...... Один мир, семь попаданцев, семь авторов, семь стилей. Каждую книгу можно читать отдельно. \--------- 1\. Полина Ром "Роза песков" 2\. Кира Страйк "Шерловая искра" 3\. Анна Лерн "Лунная Радуга" 4\. Игорь Лахов "Недостойный сын" 5.Марьяна Брай "На волоске" 6\. Эва Гринерс "Глаз бури" 7\. Алексей Арсентьев "Мост Индары"

Анна Лерн , Анна (Нюша) Порохня , Сергей Иванович Павлов

Фантастика / Любовное фэнтези, любовно-фантастические романы / Самиздат, сетевая литература / Космическая фантастика / Научная Фантастика