From 3b7d11c6182b8aa3d3d4f9e36c213e4eba6c8d8f Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 30 Jul 2020 19:42:26 +0200 Subject: Add cards from CardsAgainstCryptography --- Makefile | 16 +++- black.txt | 75 ++++++++++++++++ client/index.html | 1 + client/src/Client.elm | 13 ++- client/src/Messages.elm | 5 +- client/style.css | 16 ++++ server/lib/Cafp/Game.hs | 17 +++- server/lib/Cafp/Main/Server.hs | 27 ++++-- server/lib/Cafp/Messages.hs | 1 + white.txt | 190 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 346 insertions(+), 15 deletions(-) create mode 100644 black.txt create mode 100644 client/style.css create mode 100644 white.txt diff --git a/Makefile b/Makefile index 5c05542..0f7a475 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,11 @@ ELM_SOURCES=$(shell find client/src -name '*.elm') ELM_MESSAGES_SOURCE=client/src/Messages.elm .PHONY: build -build: server/assets/client.js server/assets/client.html +build: server/assets/client.js \ + server/assets/client.html \ + server/assets/style.css \ + server/assets/black.txt \ + server/assets/white.txt server: build cd server && stack exec cafp-server @@ -20,5 +24,13 @@ server/assets/client.js: $(ELM_MESSAGES_SOURCE) $(ELM_SOURCES) cd client && elm make src/Client.elm --output=../server/assets/client.js server/assets/client.html: client/index.html - mkdir -p server/assets cp client/index.html $@ + +server/assets/style.css: client/style.css + cp $< $@ + +server/assets/black.txt: black.txt + cp $< $@ + +server/assets/white.txt: white.txt + cp $< $@ diff --git a/black.txt b/black.txt new file mode 100644 index 0000000..e7383a5 --- /dev/null +++ b/black.txt @@ -0,0 +1,75 @@ +A crypto conference is never complete without \BLANK. +A recent laboratory study shows that undergrads have 50\% less sex after being exposed to \BLANK. +A romantic, candlelit dinner would be incomplete without \BLANK. +Both Microsoft and Apple have concerns with \BLANK. +Bruce Schneier's new book has a chapter on \BLANK. +Despite his work at Bletchley Park, Alan Turing is little know for his work on \BLANK. +Did you hear that \BLANK is the new hot topic? +Due to the Covid crisis, I have rekindled my enthusiasm for \BLANK. +During sex, I like to think about \BLANK. +Having really bad gas throughout November led to \BLANK. +I always include \BLANK in my reviewer feedback. +I can't believe I got away with \BLANK. +I can't believe my grant application for \BLANK was denied! +I can't concentrate without \BLANK. +I deserve to be an IACR fellow for my groundbreaking contributions to \BLANK. +I don't encrypt my files, I keep them hidden in \BLANK. +I drink to forget \BLANK. +I felt sick to my stomach at PKC because of \BLANK. +I find that \BLANK relieves pre-submission stress. +I get by with a little help from \BLANK. +I got 99 problems but \BLANK ain't one. +I hope no one finds out about \BLANK. +I just got out of an incomprehensible talk on \BLANK. +I just hope the reviewers don't notice \BLANK. +I only got through my PhD because of a long-winded explanation of \BLANK. +I swear I didn't go to Financial Crypto because of the location, I went for \BLANK. +I think I will skip the session on \BLANK this year. +I was going to include Katz and Lindell as recommended reading, but it doesn't contain anything on \BLANK. +I was surprised to see anyone awake at the end of my presentation on \BLANK. +I woke up drenched in sweat from a nightmare about \BLANK. +I woke up filled with shame about \BLANK. +I'll eat my hat if anyone ever breaks \BLANK. +I'm hoping to avoid 2/3 of the program committee, because my paper is on \BLANK. +I'm sorry, Professor, but I couldn't complete my homework because of \BLANK. +I've had it with these blockchain bros! ``Crypto'' means \BLANK. +It took 72,000 instances, but I finally cracked \BLANK. +It turns out that my company's password policy requires \BLANK. +My academic CV says I'm an expert on \BLANK. +My career started with \BLANK. +My favourite thing about online conferences is \BLANK. +My encryption scheme is extra secure because of \BLANK. +My first accepted paper was on provably secure \BLANK. +My latest paper on \BLANK will help me get more citations than Mihir Bellare. +My student couldn't complete their homework due to \BLANK. +Oh no! I just saw Koblitz and Menezes taking another look at \BLANK. +One regret I have from my PhD is \BLANK. +Putting \BLANK in my application helped me immensely. +RWC was already full when I tried to register because I was too busy \BLANK. +Remembering \BLANK, then immediately vomiting. +Self-isolation is fantastic for \BLANK. +TSA guidelines now prohibit \BLANK on airplanes. +Talk dirty to me, baby. Tell me about \BLANK. +The Bletchley Park Museum has just opened an interactive exhibit on \BLANK. +The Israeli government stores its data with \BLANK. +The best thing about having Eurocrypt 2020 online was \BLANK. +The next big thing will almost certainly be \BLANK. +The talk that had the most influence on my personal life was \BLANK. +The thing I love most about staying in the UCSB dorms during Crypto is \BLANK. +The way things are going, the best paper at Crypto 2048 will probably be about \BLANK. +There is nothing quite like \BLANK, alone in the office at night. +WTF! My paper on \BLANK just got rejected from the ePrint server. +What ended my last relationship? +What gets better with age? +What is the best way to wind down at the end of a hard day? +What never fails to liven up the Eurocrypt banquet? +What will always get you laid? +What's a cryptographer's best friend? +What's my secret power? +When I am President of the United States, I will create the Department of \BLANK. +When all this is over, I'm not looking forward to \BLANK. +When my crypto patents turn me into a billionaire, I will erect a 50-foot statue to commemorate \BLANK. +Why can't I sleep at night? +Yo' momma so dumb she encrypts her files with \BLANK. +\BLANK kept me up all night. +\BLANK was the last thing I expected to find in Edward Snowden's leaked documents. diff --git a/client/index.html b/client/index.html index 75ee56d..adc2ac8 100644 --- a/client/index.html +++ b/client/index.html @@ -3,6 +3,7 @@ Client +
diff --git a/client/src/Client.elm b/client/src/Client.elm index 1938711..efd97fb 100644 --- a/client/src/Client.elm +++ b/client/src/Client.elm @@ -67,7 +67,18 @@ view model = case model of ] [Html.text "change"] ] - ] + ] ++ + (case game.view.blackCard of + Nothing -> [] + Just c -> [blackCard c]) + +blackCard : String -> Html a +blackCard string = + let blank = Html.span [Html.Attributes.class "blank"] [] in + Html.div [Html.Attributes.class "black"] <| + List.intersperse blank <| + List.map Html.text <| + String.split "\\BLANK" string subscriptions : Model -> Sub Msg subscriptions model = webSocketIn WebSocketIn diff --git a/client/src/Messages.elm b/client/src/Messages.elm index 3fbacc3..77b3830 100644 --- a/client/src/Messages.elm +++ b/client/src/Messages.elm @@ -11,19 +11,22 @@ import Set exposing (Set) type alias GameView = { opponents: (List String) , myName: String + , blackCard: (Maybe String) } jsonDecGameView : Json.Decode.Decoder ( GameView ) jsonDecGameView = - Json.Decode.succeed (\popponents pmyName -> {opponents = popponents, myName = pmyName}) + Json.Decode.succeed (\popponents pmyName pblackCard -> {opponents = popponents, myName = pmyName, blackCard = pblackCard}) |> required "opponents" (Json.Decode.list (Json.Decode.string)) |> required "myName" (Json.Decode.string) + |> fnullable "blackCard" (Json.Decode.string) jsonEncGameView : GameView -> Value jsonEncGameView val = Json.Encode.object [ ("opponents", (Json.Encode.list Json.Encode.string) val.opponents) , ("myName", Json.Encode.string val.myName) + , ("blackCard", (maybeEncode (Json.Encode.string)) val.blackCard) ] diff --git a/client/style.css b/client/style.css new file mode 100644 index 0000000..fd26c52 --- /dev/null +++ b/client/style.css @@ -0,0 +1,16 @@ +html { + font-size: 18px; +} + +.black { + color: white; + background: black; + padding: 18px; + border-radius: 18px; +} + +.blank { + border-bottom: 2px solid white; + display: inline-block; + width: 42px; +} diff --git a/server/lib/Cafp/Game.hs b/server/lib/Cafp/Game.hs index af958ae..a083e57 100644 --- a/server/lib/Cafp/Game.hs +++ b/server/lib/Cafp/Game.hs @@ -3,6 +3,7 @@ {-# LANGUAGE TemplateHaskell #-} module Cafp.Game ( PlayerId + , Cards (..) , Game (..) , newGame @@ -15,7 +16,7 @@ module Cafp.Game ) where import Cafp.Messages -import Control.Lens (at, ix, over, (%~), (&), (.~), (^.)) +import Control.Lens (at, ix, over, (%~), (&), (.~), (^.), (^?)) import Control.Lens.TH (makeLenses) import qualified Data.HashMap.Strict as HMS import Data.Maybe (fromMaybe) @@ -24,15 +25,22 @@ import qualified Data.Text as T type PlayerId = Int +data Cards = Cards + { _cardsBlack :: [T.Text] + , _cardsWhite :: [T.Text] + } deriving (Show) + data Game = Game - { _gamePlayers :: !(HMS.HashMap Int Text) + { _gameCards :: !Cards + , _gamePlayers :: !(HMS.HashMap Int Text) , _gameNextPlayerId :: !Int } deriving (Show) +makeLenses ''Cards makeLenses ''Game -newGame :: Game -newGame = Game HMS.empty 1 +newGame :: Cards -> Game +newGame cards = Game cards HMS.empty 1 joinGame :: Game -> (PlayerId, Game) joinGame game = @@ -58,4 +66,5 @@ gameViewForPlayer self game = GameView { gameViewOpponents = opponents , gameViewMyName = name + , gameViewBlackCard = game ^? gameCards . cardsBlack . ix 0 } diff --git a/server/lib/Cafp/Main/Server.hs b/server/lib/Cafp/Main/Server.hs index e87bfb5..eae887e 100644 --- a/server/lib/Cafp/Main/Server.hs +++ b/server/lib/Cafp/Main/Server.hs @@ -18,6 +18,7 @@ import qualified Data.HashMap.Strict as HMS import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T +import qualified Data.Text.IO as T import qualified Data.Text.Lazy as TL import qualified Network.Wai as Wai import qualified Network.Wai.Handler.Warp as Warp @@ -39,14 +40,22 @@ data Room = Room } data Server = Server - { serverRooms :: TVar (HMS.HashMap RoomId Room) + { serverCards :: Cards + , serverRooms :: TVar (HMS.HashMap RoomId Room) } -newServer :: STM Server -newServer = Server <$> STM.newTVar HMS.empty +readCards :: IO Cards +readCards = Cards + <$> fmap T.lines (T.readFile "assets/black.txt") + <*> fmap T.lines (T.readFile "assets/white.txt") -newRoom :: STM Room -newRoom = Room <$> STM.newTVar newGame <*> STM.newTVar HMS.empty +newServer :: IO Server +newServer = Server <$> readCards <*> atomically (STM.newTVar HMS.empty) + +newRoom :: Server -> STM Room +newRoom server = Room + <$> STM.newTVar (newGame $ serverCards server) + <*> STM.newTVar HMS.empty scottyApp :: IO Wai.Application scottyApp = Scotty.scottyApp $ do @@ -61,6 +70,10 @@ scottyApp = Scotty.scottyApp $ do Scotty.setHeader "Content-Type" "application/JavaScript" Scotty.file "assets/client.js" + Scotty.get "/assets/style.css" $ do + Scotty.setHeader "Content-Type" "text/css" + Scotty.file "assets/style.css" + routePendingConnection :: WS.PendingConnection -> Maybe RoomId routePendingConnection pending = let path = T.decodeUtf8 . WS.requestPath $ WS.pendingRequest pending in @@ -74,7 +87,7 @@ getOrCreateRoom server roomId = do case HMS.lookup roomId rooms of Just room -> pure room Nothing -> do - room <- newRoom + room <- newRoom server STM.writeTVar (serverRooms server) $ HMS.insert roomId room rooms pure room @@ -131,7 +144,7 @@ main :: IO () main = do let port = 3000 settings = Warp.setPort port Warp.defaultSettings - server <- atomically newServer + server <- newServer sapp <- scottyApp Warp.runSettings settings $ WaiWs.websocketsOr WS.defaultConnectionOptions (wsApp server) sapp diff --git a/server/lib/Cafp/Messages.hs b/server/lib/Cafp/Messages.hs index 29f5575..3e345f2 100644 --- a/server/lib/Cafp/Messages.hs +++ b/server/lib/Cafp/Messages.hs @@ -11,6 +11,7 @@ import Elm.Derive data GameView = GameView { gameViewOpponents :: [Text] , gameViewMyName :: Text + , gameViewBlackCard :: Maybe Text } deriving (Show) data ServerMessage diff --git a/white.txt b/white.txt new file mode 100644 index 0000000..ec5e8ea --- /dev/null +++ b/white.txt @@ -0,0 +1,190 @@ +100\% talks, \\ 0\% human interaction. +16-bit AES. +17 slides for a 3-minute rump session talk. +2 to 4 kilograms of top quality amphetamines. +2-sentence Eurocrypt reviews. +387 contact tracing papers submitted to Eurocrypt 2021. +4mm reasonable margins. +A 25-year old policy on sexual harassment. +A Facebook friend request from a cryptographer I~actually despise. +A career-limiting card game. +A dancing cryptographer. +A genuine attempt to configure IPsec. +A hand wavy argument. +A long-term nonce. +A non-fabricated use of pairings. +A painfully slow Tor masturbation session. +A popup Skype notification from ``lovemachine69'' during my keynote talk. +A proof that appears in the ``full version''. +A shepherd that won't budge. +A tight security reduction to the problem of fending off a sexually voracious goat. +A violent and bloody PhD defence. +Aaron Aaronson's insistence on alphabetical author ordering. +Academic integrity. +Accidentally sexting my co-supervisor. +Actually being ``sorry for the late reply''. +Actually efficient indistinguishability obfuscation. +Adleman-Rivest-Shamir encryption (the ARSE algorithm). +An IACR board meeting. +An SSL vulnerability with a silly name. +An ``anonymous'' reviewer insisting I cite 6 papers by the same author. +An inappropriate workplace romance. +An insecure VPN straight to the Kremlin. +An overfull hbox. +An overlooked patent. +Arguing savagely against contact tracing so no one finds out that I don't get invited to parties. +Arriving 13 minutes late to a 15 minute talk and having the gall to ask a question. +Asking for 2 room keys during check-in, knowing full well I'm not getting laid. +Bart Preneel's \\ private key. +Beefing up my Proposition to a Theorem because I'm that awesome. +Being forced to attend social events because I'm the visitor's official host. +Being the only smartly dressed person in the room. +Best rejected paper award. +Bragging about getting held up at Border Control for saying I'm a cryptographer. +Brexit. +Checking my Google Scholar profile daily. +Chocolate-covered shrimp. +Citing personal communication. +Conferences with 5 submissions at 11:59pm. +Crippling student debt. +Crypto wars. +Day drinking. +Deadline day flatulence. +Deliberately hiding inefficiencies inside the big O. +Deliberately not referencing a superior paper. +Desperately trying to plug my crypto research into a grant application on pandemic prevention. +Diffie but definitely not Hellman. +Doing Facebook maths puzzles to show I am better than those idiot 97\%. +Double ROT-13. +Drinking alone. +Dropping the word Blockchain into my research proposal as many times as possible. +Dual\_EC\_DRBG. +Encrypted database security definitions. +Explaining what my job is at a family reunion. +Falling asleep in a 5-person meeting. +Feeling flattered because a conference spam email addressed me as Professor. +Fighting over LaTeX syntax. +Filing a patent application for modular multiplication... in 2017. +Flirting with people at the conference registration desk. +Forgetting my VGA adapter. +Frantically taking notes during every talk. +GDPR requirements. +Getting a fourth cookie during a coffee break because I have no one to talk to. +Getting rejected, but then taking immediate solace in the fact that the selection of papers was a difficult and challenging task. +Getting stuck at the French-speaking banquet table. +Getting tenure, then chilling the f--- right out! +Getting turned on by a proof. +Going straight to journal. +Government-mandated backdoors. +HTTPS everywhere! +Hands-on supervision. +Having time to catch up on my reading, \\ then not doing it. +Having to wear pants. +Having to write a polite rebuttal to the reviewer who clearly didn't read past page 2. +Hiding my conflict of interest. +Hillary Clinton's BlackBerry. +Home-baked, snake oil crypto. +Ignoring reviewer comments and resubmitting immediately. +Ignoring the session chair flashing 5 minutes left because I've got 23 slides to go. +Including an XKCD comic in my slides because I'm so original. +Knapsack cryptosystems, revisited. +LNCS' 25-foot margins. +Making claims in the submission that you hope you can achieve before the rebuttal. +Maths-terbation. +My Silk Road purchase history. +My \textit{h}-index. +My automated reply saying ``email responses will be delayed'', when I know damn well I'll be online with high-speed internet access 24/7. +My butt. +My crypto blog views getting into the double digits. +My dear friend the Program Chair overruling 3 borderline rejects on my paper. +My genitals. +My inappropriate supervisor. +My inflated sense of self-importance that warrants my PGP key. +My much more successful career as a singer after rocking the Crypto rump session. +My relationship status. +My second divorce. +My sex life. +My side job as an incompetent security consultant. +My successful career at a patent troll company. +My supervisor's morning breath. +Nigel Smart's new Hawaiian shirt. +Not being important enough to be asked to sign the public statement on contact tracing. +Not feeling guilty about falling asleep during the keynote. +Not having to wear pants. +Not needing to pretend to listen to the other speakers in my session. +Overselling it hard in the introduction. +Password1. +Picturing the FSE audience naked. +Politely starting an answer with ``That's a good question...'', when the question is actually idiotic. +Post-quantum RSA. +Preparing for two weeks to give a 15-minute presentation to a room of 7 people all on their laptops. +Pretending to care when my vegetarian coauthor complains about the lack of banquet options. +Pretending to understand. +Pubic key cryptography. +Publishing anyway. +Purchasing the Springer hardcopies I publish in because my mom is collecting them. +Putting an outdoors-y photo on my academic webpage to look well-rounded. +Quadruple XOR. +Quantum key distribution. +Quickly trying to peek at someone's badge as I shake their hand, but it's flipped backwards. +Reading the person in front's emails. +Relatives who ask me to help them install their printer on Windows. +Remembering when `working from home' meant a day off. +Rogaway's loose morals. +Satoshi Nakamoto. +Security through obscurity. +Sending an email at 11pm so people think I work hard. +Serious rump session speakers. +Sexual tension. +Skype dropping out every 10 to 15 seconds. +Social sciences. +Someone less senior than me signing off with ``Thanks in advance''. +Spending 3 Bitcoin on pizza in 2012. +Spending all of my Levchin prize money on cocaine. +Springer's editorial team. +Starting a conversation with ``When did you fly in?'', because I have nothing interesting to say. +Taking a group shower with my recent co-authors. +Telling anyone who'll listen quite how busy I am. +Thanking the anonymous reviewers for their ``useful'' comments. +That feeling when my article is sitting pretty at the top of the ePrint archive. +That one asshole who's always sleeping during my Eurocrypt talks. +The MIT Mafia. +The NSA's massive stack of amateur porn. +The North Korean Cryptographic Standard. +The awkward question the chair asks when nobody understood the talk. +The awkward silence of 8 people standing in a circle during the afternoon coffee break. +The great firewall of China. +The great paywall of IEEE. +The intoxicating aroma of 12 PhD students in one office. +The latest dance mix album by DJ~Bernstein. +The one person I don't want to get stuck next to on the conference excursion bus. +The one really hot person at CHES registration drinks. +The one suit I own for meetings with industry. +The person in the front row taking photos of every slide. +The secret flash drive hidden in my underwear. +The sound of 50 people on a Zoom call all trying to speak at once. +The student body. +The walking zombie corpse of Claude Shannon. +Thinking I'm so clever for using pictures of Alice (Cooper) and Bob (Marley). +Throwing a party for my next citation milestone. +Trying to make TCC friends at the bar in order to get the IACR 7-conference grand slam. +Turbulent bowel movements in the middle of my Asiacrypt presentation. +Turning up to one meeting and claiming co-authorship. +Tweeting about my paper acceptance. +Unbreakable military-grade encryption. +Undergrads. +Using Beamer because it's social suicide to use PowerPoint. +Using ``it clearly follows'' when the implied following is anything but clear. +Using ``we should talk about this offline'' because the question exposes holes in my paper. +Using indecipherable, non-standard notation to hide a dodgy proof. +Vital sugar beet auctions. +WalnutDSA. +Wearing a T-shirt with a Linux joke. +Wearing a conference t-shirt... in public. +When you realize that quantum computers have been 10 years away for 3 decades. +Wistfully looking out of the window of my overly-cramped PhD office. +Writing a reference for someone I can't remember meeting. +Yet another cryptographer falling into the blockchain startup abyss. +\texttt{Ctrl+F}'ing to see how many times I'm cited and finding ``0 results''. +``Working'' remotely. +{\comicsans A slide deck entirely in Comic Sans.} -- cgit v1.2.3