Request for Concern F. !important Intended status: Cursed S. Elector Expires: When CSS does C. L. Opus CS24: CSS Web Signature Algorithm Abstract This document defines CS24, a CSS Web Signature (CWS) algorithm that computes "digital signatures" using nothing but Cascading Style Sheets (CSS). The algorithm employs a 24-bit XOR-based construction with header folding, implemented entirely through CSS selectors, counters, and counter styles. CS24 provides exactly zero bits of security and MUST NOT be used to protect anything of value, perceived value, or sentimental value. Ever. Status of This Memo This document is published for entertainment and to answer the question "but why?" with "but why not?". It has not been submitted to, reviewed by, or endorsed by anyone, and the authors would like to preemptively apologize to anyone who reads it. It is not an Internet Standard. Do not cite this in production security architectures. Do not cite this at all, really. Copyright Notice Copyright (c) 2026 the authors. All rights reserved. Distributed under the MIT License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 2 2. Conventions and Definitions . . . . . . . . . . . . . . . 3 3. Algorithm Identifier . . . . . . . . . . . . . . . . . . . 3 4. Key Representation . . . . . . . . . . . . . . . . . . . . 3 5. Header . . . . . . . . . . . . . . . . . . . . . . . . . . 4 6. Payload . . . . . . . . . . . . . . . . . . . . . . . . . 4 7. Signature Computation . . . . . . . . . . . . . . . . . . 5 7.1. Header Folding . . . . . . . . . . . . . . . . . . . . 5 7.2. XOR Combination . . . . . . . . . . . . . . . . . . . 6 7.3. Output Encoding . . . . . . . . . . . . . . . . . . . 6 8. Signature Verification . . . . . . . . . . . . . . . . . . 7 9. CSS Implementation . . . . . . . . . . . . . . . . . . . . 7 9.1. Counter Styles . . . . . . . . . . . . . . . . . . . . 7 9.2. Bit Input via Checkboxes . . . . . . . . . . . . . . . 8 9.3. Counter Accumulation . . . . . . . . . . . . . . . . . 8 9.4. XOR via Selector Pairs . . . . . . . . . . . . . . . . 9 9.5. Header Constant Baking . . . . . . . . . . . . . . . . 10 9.6. Verification via Mismatch Selectors . . . . . . . . . 10 9.7. Output Rendering . . . . . . . . . . . . . . . . . . . 11 10. Serialization . . . . . . . . . . . . . . . . . . . . . . 11 11. Test Vector . . . . . . . . . . . . . . . . . . . . . . . 12 12. Security Considerations . . . . . . . . . . . . . . . . . 14 13. IANA Considerations . . . . . . . . . . . . . . . . . . . 15 14. References . . . . . . . . . . . . . . . . . . . . . . . . 15 14.1. Normative References . . . . . . . . . . . . . . . . . 15 14.2. Informative References . . . . . . . . . . . . . . . . 16 Appendix A. Header Constant Derivation . . . . . . . . . . . 16 Appendix B. Full Bit-Position Table . . . . . . . . . . . . . 17 Appendix C. Browser Requirements . . . . . . . . . . . . . . 18 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 18 1. Introduction JSON Web Signatures [RFC7515] define a compact, URL-safe means of representing signed content. The signature algorithms registered for use with JWS [RFC7518] rely on traditional cryptographic primitives implemented in general-purpose programming languages, like reasonable people would. This document takes a profoundly different approach. CS24 (Cascading Stylesheet 24) is a CWS algorithm implemented entirely in CSS. It requires no JavaScript, no WebAssembly, and no server-side computation. It does not require cryptographic expertise, because it does not perform cryptography. All "cryptographic" operations --- such as they are --- are performed by the browser's CSS engine through creative abuse of selectors, counters, and counter styles. The algorithm operates on a fixed 24-bit payload (3 octets) --- enough for a short greeting or a cry for help --- and produces a 24-bit signature using XOR with a 24-bit key, after folding the CWS header into a 24-bit constant. The resulting token is serialized in CWS Compact Serialization format. CS24 is a parody of HS256 (HMAC-SHA256) as defined in [RFC7518] Section 3.2. Where HS256 provides actual security through HMAC-SHA256, CS24 provides 0-bit security through XOR. This is not a typo. Zero. Like the number. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. The phrase "WHY WOULD YOU" is used informally throughout. 2. Conventions and Definitions The following terms are used throughout this document: Bit position: An integer from 0 to 23 identifying a single bit within the 24-bit space. Bit 0 is the most significant bit of the first octet; bit 23 is the least significant bit of the third octet. Base64URL: Base64 encoding using the URL-safe alphabet [RFC4648] Section 5, without padding. XOR: Bitwise exclusive-or operation. The entirety of the cryptographic foundation of this specification. XNOR: Bitwise exclusive-nor operation (the complement of XOR); produces 1 when both inputs are equal. Twice the complexity of the above, hence "advanced cryptography". Header constant: A 24-bit value derived by XOR-folding the serialized CWS header octets. CSS counter: A named integer maintained by the CSS engine via the counter-reset and counter-increment properties. 3. Algorithm Identifier The algorithm identifier for CS24 is: "CS24" When used in a CWS header, it appears as the value of the "alg" parameter: {"alg":"CS24"} This identifier is NOT registered with IANA and MUST NOT be registered with IANA, no matter how politely one asks. It exists solely within the cursed domain of CSS computation, where it SHALL remain. 4. Key Representation A CS24 key is a sequence of exactly 24 bits (3 octets). In the CSS implementation, each bit is represented by the state of a checkbox input element with an identifier of the form "kN" where N is the bit position (0-23). A checked checkbox represents a bit value of 1; an unchecked checkbox represents 0. There is no JSON Web Key (JWK) representation defined for CS24 keys, because defining one would imply this algorithm is suitable for actual use. It is emphatically not. Keys are displayed visually as checkboxes on screen, which is believed to be the least secure key storage mechanism ever devised. 5. Header The CWS Protected Header for CS24 is the JSON object: {"alg":"CS24"} Its UTF-8 serialization is 14 octets: 7B 22 61 6C 67 22 3A 22 43 53 32 34 22 7D Base64URL-encoded, the header is: eyJhbGciOiJDUzI0In0 The header is fixed for all CS24 tokens. Implementations MUST NOT include additional header parameters, not because of security, but because the authors already wrote 96 CSS selectors and are not writing more. The "typ" parameter is omitted because it has proven less than useful in JWT in the first place, and because every byte matters when your entire computation budget is CSS counters. 6. Payload The CS24 payload is exactly 24 bits (3 octets). This constrains the payload to 3 ASCII characters or any 3-octet binary value. This is sufficient for messages such as "Hi!", "lol", "why", and "no.". Longer messages are left as future work that SHOULD NOT be undertaken. In the CSS implementation, each bit is represented by a checkbox input element with an identifier of the form "pN" where N is the bit position (0-23). The 24-bit payload is split into four 6-bit groups for Base64URL encoding: 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Octet 0 | Octet 1 | Octet 2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | c0 | c1 | c2 | c3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Where c0, c1, c2, c3 are 6-bit values (0-63) each mapping to a single Base64URL character. The payload is also decoded into three ASCII byte values (byte0, byte1, byte2) for display purposes, where each byte spans 8 consecutive bit positions. 7. Signature Computation The CS24 signature is computed as: signature = header_constant XOR payload XOR key Where all three operands are 24-bit values. The operation is performed bitwise across all 24 positions. 7.1. Header Folding The header constant is derived from the UTF-8 serialization of the CWS Protected Header by XOR-folding into 3 octets. Given the header octets h[0], h[1], ..., h[n-1], the folded value F is computed as: F[0] = h[0] XOR h[3] XOR h[6] XOR h[9] XOR h[12] F[1] = h[1] XOR h[4] XOR h[7] XOR h[10] XOR h[13] F[2] = h[2] XOR h[5] XOR h[8] XOR h[11] More generally: F[i] = XOR of all h[j] where j mod 3 == i For the fixed CS24 header {"alg":"CS24"} (14 octets), this yields: F[0] = 0x7B XOR 0x6C XOR 0x3A XOR 0x43 XOR 0x22 = 0x5C F[1] = 0x22 XOR 0x67 XOR 0x22 XOR 0x53 XOR 0x34 XOR 0x7D = 0x28 F[2] = 0x61 XOR 0x22 XOR 0x43 XOR 0x32 = 0x34 The header constant is therefore: 0x5C2834 In binary: 01011100 00101000 00110100 The bit positions where the header constant is 1 are: {1, 3, 4, 5, 10, 12, 18, 19, 21} 7.2. XOR Combination For each bit position i (0 <= i <= 23): sig[i] = H[i] XOR P[i] XOR K[i] Where: H[i] is bit i of the header constant (Section 7.1) P[i] is bit i of the payload K[i] is bit i of the key Since XOR is associative and commutative, this is equivalent to: sig = H XOR P XOR K The three-way XOR can be decomposed as follows. For each bit position i: If H[i] = 0: sig[i] = P[i] XOR K[i] (standard XOR) If H[i] = 1: sig[i] = P[i] XNOR K[i] (inverted XOR) This decomposition is critical to the CSS implementation (Section 9.5), as the header constant is baked into the selector structure at authoring time. 7.3. Output Encoding The 24-bit signature is split into four 6-bit groups and encoded using Base64URL, identical to the payload encoding: sig_b64 = Base64URL(sig[0..5]) || Base64URL(sig[6..11]) || Base64URL(sig[12..17]) || Base64URL(sig[18..23]) This produces exactly 4 Base64URL characters. 8. Signature Verification To verify a CS24 signature: 1. Compute the expected signature as described in Section 7. 2. Compare each of the 24 bits of the provided signature against the expected signature. 3. If ALL 24 bits match, the signature is VALID. 4. If ANY bit differs, the signature is INVALID. There is no timing-safe comparison requirement, because there is nothing to protect. The signature is visible on screen at all times. An attacker need only possess functioning eyesight. In the CSS implementation, verification uses 96 mismatch selectors (4 per bit position x 24 bits). The default state is VALID; any matching mismatch selector overrides the display to INVALID. 9. CSS Implementation This section describes how CS24 is implemented using only CSS features. No JavaScript is used. The authors wish to emphasize this point: zero JavaScript. Every computation described below occurs within the browser's style engine, which was never designed for this and has filed no complaints. 9.1. Counter Styles Two custom counter styles are defined: base64url: Maps integers 0-63 to the Base64URL alphabet. @counter-style base64url { system: fixed 0; symbols: "A" "B" "C" ... "9" "-" "_"; } The "system: fixed 0" declaration means the first symbol ("A") corresponds to counter value 0, the second ("B") to 1, and so on through all 64 symbols of the Base64URL alphabet. ascii: Maps integers 32-126 to printable ASCII characters. @counter-style ascii { system: fixed 32; symbols: " " "!" ... "~"; fallback: decimal; } The "system: fixed 32" declaration means the first symbol (" ") corresponds to counter value 32 (the ASCII code for space). 9.2. Bit Input via Checkboxes Each input bit is represented by an HTML checkbox element: (payload bit 0) (key bit 0) (verification signature bit 0) The checked/unchecked state of each checkbox is readable from CSS using the :checked pseudo-class and the :has() relational pseudo- class: #cws:has(#p0:checked) /* payload bit 0 is 1 */ #cws:has(#k0:not(:checked)) /* key bit 0 is 0 */ All 72 checkboxes (24 payload + 24 key + 24 verification) are contained within a single