
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sun, 05 Apr 2026 04:48:59 GMT</lastBuildDate>
        <item>
            <title><![CDATA[You don’t need quantum hardware for post-quantum security]]></title>
            <link>https://blog.cloudflare.com/you-dont-need-quantum-hardware/</link>
            <pubDate>Fri, 19 Sep 2025 13:44:40 GMT</pubDate>
            <description><![CDATA[ Post-quantum cryptography protects against quantum threats using today’s hardware. Quantum tech like QKD may sound appealing, but it isn’t necessary or sufficient to secure organizations. ]]></description>
            <content:encoded><![CDATA[ <p>Organizations have finite resources available to combat threats, both by the adversaries of today and those in the not-so-distant future that are armed with quantum computers. In this post, we provide guidance on what to prioritize to best prepare for the future, when quantum computers become powerful enough to break the conventional cryptography that underpins the security of modern computing systems.  We describe how <a href="https://www.cloudflare.com/learning/ssl/quantum/what-is-post-quantum-cryptography/"><u>post-quantum cryptography (PQC)</u></a> can be deployed <b>on your existing hardware</b> to protect from threats posed by <a href="https://www.cloudflare.com/learning/ssl/quantum/what-is-quantum-computing/"><u>quantum computing</u></a>, and explain why quantum key distribution (QKD) and quantum random number generation (QRNG) are neither necessary nor sufficient for security in the quantum age.</p>
    <div>
      <h2>Are you quantum ready?</h2>
      <a href="#are-you-quantum-ready">
        
      </a>
    </div>
    <p>“Quantum” is becoming one of the most heavily used buzzwords in the tech industry. What does it actually mean, and why should you care?</p><p>At its core, “quantum” refers to technologies that harness principles of quantum mechanics to perform tasks that are not feasible with classical computers. Quantum computers have exciting potential to unlock advancements in <a href="https://pubs.aip.org/aip/jap/article/133/22/221102/2896017/Quantum-computing-and-materials-science-A"><u>materials science</u></a> and <a href="https://www.weforum.org/stories/2025/01/quantum-computing-drug-development/"><u>medicine</u></a>, but also pose a <a href="https://blog.cloudflare.com/the-quantum-menace/"><u>threat</u></a> to computer security systems. The term <i>Q-day</i> refers to the day that adversaries possess quantum computers that are large and stable enough to break the conventional <a href="https://www.cloudflare.com/learning/ssl/how-does-public-key-encryption-work/"><u>public-key cryptography</u></a> that secures much of today’s data and communications. Recent <a href="https://sam-jaques.appspot.com/quantum_landscape"><u>advances in quantum computing</u></a> have made it clear that it is no longer a question of <i>if </i>Q-day will arrive, but <i>when</i>.</p><p>What does it mean, then, for your organization to be <a href="https://www.cloudflare.com/the-net/top-of-mind-technology/post-quantum-security/"><u>quantum ready</u></a>? At Cloudflare, our definition is simple: <i>your systems and communications should be secure even after Q-day</i>. </p><p>However, this definition often gets muddied by vendors insisting that products <i>built using quantum technology</i> are required in order to <i>secure </i>an organization <i>against quantum adversaries</i>. In this blog post we explain why quantum technologies are neither necessary nor sufficient to <a href="https://www.cloudflare.com/the-net/security-signals/post-quantum-era/"><u>protect against attacks by a quantum adversary</u></a>.</p><p>The good news is that there is already a solution: <a href="https://www.cloudflare.com/learning/ssl/quantum/what-is-post-quantum-cryptography/"><u>post-quantum cryptography (PQC)</u></a>. PQC protects against attacks by quantum adversaries, but PQC is not a quantum technology — it runs on conventional computers without specialized hardware. You can use PQC today on the computers you already have, without buying expensive new hardware.</p>
    <div>
      <h2>Post-quantum cryptography</h2>
      <a href="#post-quantum-cryptography">
        
      </a>
    </div>
    <p>We’ve written <a href="https://blog.cloudflare.com/tag/post-quantum/"><u>quite a few blog posts</u></a> on post-quantum cryptography already, so we will keep this section brief.</p><p>The <a href="https://en.wikipedia.org/wiki/Public-key_cryptography"><u>public-key cryptography</u></a> that we’ve used for decades to secure our data and communications is based on math problems (like <a href="https://en.wikipedia.org/wiki/RSA_cryptosystem"><u>factoring large numbers</u></a>) that are believed to be <a href="https://en.wikipedia.org/wiki/Computational_hardness_assumption"><u>computationally hard</u></a> to solve on conventional computers. If you can efficiently solve the underlying math problem, you can efficiently break the cryptography and the systems that depend on it. As it turns out, the math problems underlying much of today’s public-key cryptography can be efficiently solved by specialized algorithms, like <a href="https://en.wikipedia.org/wiki/Shor%27s_algorithm"><u>Shor’s algorithm</u></a>, on large-scale quantum computers. </p><p>The solution? Pick new hard math problems (like finding <a href="https://blog.cloudflare.com/lattice-crypto-primer/"><u>“short” vectors in algebraic lattices</u></a>) that are no easier to solve with a quantum computer than with a conventional computer. Then, build new cryptographic systems around them. The <a href="https://www.nist.gov/"><u>US National Institute of Standards and Technologies (NIST)</u></a> launched an <a href="https://csrc.nist.gov/projects/post-quantum-cryptography/post-quantum-cryptography-standardization"><u>international competition</u></a> in 2016 to identify and standardize such cryptographic systems, which resulted in several new standards for post-quantum cryptography being published in 2024, and <a href="https://blog.cloudflare.com/another-look-at-pq-signatures/"><u>several more under consideration</u></a> for future standardization.</p><p>Post-quantum cryptography (PQC) runs on your existing phones, laptops, and servers. PQC runs at <a href="https://radar.cloudflare.com/adoption-and-usage#post-quantum-encryption-adoption"><u>Internet scale</u></a> and can even be <a href="https://blog.cloudflare.com/pq-2024/#ml-kem-versus-x25519"><u>more performant</u></a> than classical cryptography. Except in rare cases, like when you need additional hardware acceleration in cheap smartcards or to replace legacy systems that lack <a href="https://en.wikipedia.org/wiki/Cryptographic_agility"><u>cryptographic agility</u></a>, there is <b>no need to purchase new hardware to migrate to PQC</b>.</p><p><b>If you want to know how to protect your organization from security threats posed by quantum computers, you can stop reading now. Post-quantum cryptography is the solution. </b></p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6V5tcIzTpANpLJ0lQFUKKJ/50c58a5536a25b39985b6fc5f17ed432/image_-_2025-09-19T142023.308.png" />
          </figure><p>Alternatively, you can read below for our perspective on hardware-based quantum security technologies that are sometimes marketed as security solutions.</p>
    <div>
      <h2>Quantum security technologies</h2>
      <a href="#quantum-security-technologies">
        
      </a>
    </div>
    <p>Quantum technologies capture the imagination. <a href="https://en.wikipedia.org/wiki/Quantum_computing"><u>Quantum computers</u></a> (possibly linked together in a <a href="https://en.wikipedia.org/wiki/Quantum_network"><u>quantum Internet</u></a>) promise to deliver breakthroughs in <a href="https://www.weforum.org/stories/2025/01/quantum-computing-drug-development/"><u>drug discovery</u></a> and <a href="https://pubs.aip.org/aip/jap/article/133/22/221102/2896017/Quantum-computing-and-materials-science-A"><u>materials science</u></a> via advanced molecular simulation. Measurement of physical <a href="https://en.wikipedia.org/wiki/Hardware_random_number_generator"><u>quantum processes</u></a> can be used to generate <a href="https://en.wikipedia.org/wiki/Entropy"><u>entropy</u></a> with mathematically <a href="https://www.nature.com/articles/s41467-022-35556-z"><u>provable properties</u></a>.</p><p>This is exciting technology and fundamental scientific research. But this technology is <b>not</b> required to secure data and communications against quantum attackers.</p><p>In this section, we’ll explain why quantum security technologies do not need to be part of your quantum readiness strategy, and <b>any decision to invest in quantum technology should not be based on a desire to defend data and communications systems against the threat of quantum adversaries. </b>Instead, investments should be based on a desire to improve quantum technologies in their own right, for example to help with applications like <a href="https://pubs.acs.org/doi/10.1021/acs.chemrev.4c00678"><u>chemistry</u></a>, <a href="https://www.cloudflare.com/learning/ai/what-is-machine-learning/"><u>machine learning</u></a>, and <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC11257328/"><u>financial modeling</u></a>.</p><p>Our position here is largely in agreement with the strategies towards quantum security technologies of the <a href="https://www.nsa.gov/Cybersecurity/Post-Quantum-Cybersecurity-Resources/"><u>US National Security Agency (NSA)</u></a>, <a href="https://www.ncsc.gov.uk/whitepaper/quantum-networking-technologies"><u>UK National Cyber Security Centre (NCSC)</u></a>, <a href="https://english.ncsc.nl/binaries/ncsc-en/documenten/publications/2024/march/25/quantum-secure/Make+your+organization+quantum+secure.pdf"><u>NL Nationaal Cyber Security Centrum (NCSC)</u></a>, and <a href="https://www.bsi.bund.de/EN/Themen/Unternehmen-und-Organisationen/Informationen-und-Empfehlungen/Quantentechnologien-und-Post-Quanten-Kryptografie/quantentechnologien-und-post-quanten-kryptografie_node.html"><u>DE Federal Office for Information Security (BSI)</u></a>. We’ll focus on two quantum technologies widely marketed as security products: quantum key distribution (QKD) and quantum random number generation (QRNG).</p>
    <div>
      <h3>Quantum key distribution</h3>
      <a href="#quantum-key-distribution">
        
      </a>
    </div>
    <p>Quantum key distribution (QKD) is a hardware-based solution to secure communications across point-to-point links. Rather than relying on hard mathematical problems, QKD relies on principles of quantum physics to establish a shared symmetric secret between two parties, while ensuring that eavesdropping can be detected. QKD provides security guarantees that are based on physical properties of the communication channel. Once a shared secret is established, parties can switch to traditional symmetric-key cryptography for secure communication. QKD is the first step towards a futuristic “quantum Internet.” However, there are some fundamental reasons why QKD cannot be a general replacement for classical cryptography running on conventional hardware.</p><p>Most importantly, <i>QKD does not operate at Internet scale</i>. QKD is used to establish an unauthenticated secret between pairs of parties with a direct physical link between them. The parties can then use an authentication mechanism based on conventional cryptography to bootstrap a secure communication channel over that link. While building dedicated physical links may be feasible for cross-datacenter communication or across major Internet backbones, it is not possible for most pairs of parties on the Internet. In particular, deploying QKD for the “last-mile” connection to end-user devices would require that each device has a direct physical connection to every server or device it needs to securely communicate with.</p><p>Connectivity aside, there's a good reason why the Internet doesn't rely on secure point-to-point links: they do not scale (or rather, they scale exponentially). Bringing a new device online would require a change to <i>every other device</i> it needs to communicate with, a massive operational burden on everyone. Fortunately, there’s a better way. The <a href="https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/"><u>OSI model</u></a> for networking provides an abstraction such that two parties can communicate even if they don’t share a direct physical link, so long as some chain of physical links exists between them. Public-key cryptography, invented in the seminal “<a href="https://www-ee.stanford.edu/~hellman/publications/24.pdf"><u>New Directions in Cryptography</u></a>” paper in 1976, allows two parties participating in the same <a href="https://en.wikipedia.org/wiki/Public_key_infrastructure"><u>public-key infrastructure</u></a> to establish a secure <a href="https://en.wikipedia.org/wiki/End-to-end_encryption"><u>end-to-end encrypted</u></a> communication channel, without requiring any prior setup between them. The massive scaling enabled by these technologies is why the secure Internet exists as we know it. Secure point-to-point links are not part of the solution.</p><p>Lack of scalability is enough for us to disqualify QKD outright: if a technology can’t bring security to the whole Internet, we’re not going to spend much time on it.</p><p>The challenges with QKD don’t stop there though.</p><p>QKD touts theoretical security guarantees, but achieving security in practice is not so simple. QKD systems have been <a href="https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/Studies/QKD-Systems/QKD-Systems.pdf?__blob=publicationFile&amp;v=3"><u>plagued by implementation attacks</u></a>, both classical <a href="https://en.wikipedia.org/wiki/Side-channel_attack"><u>sidechannel attacks</u></a> and <a href="https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/Studies/QKD-Systems/QKD-Systems.pdf?__blob=publicationFile&amp;v=3"><u>new ones</u></a> specific to the technology. Further, QKD works best over a special medium: either <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC4646568/"><u>fiber</u></a> or a <a href="https://journals.aps.org/prapplied/abstract/10.1103/PhysRevApplied.19.064003"><u>vacuum</u></a>. QKD has been demonstrated <a href="https://iopscience.iop.org/article/10.1088/1367-2630/16/4/043003"><u>over the air</u></a>, but performance and the implementation security mentioned before suffers. We still have not seen QKD work on a mobile phone or over Wi-Fi networks.</p><p>Further, neither QKD nor any other quantum technologies provide authentication to prove that the party on the other end of the key exchange is who you think they are. This opens the door for a classic <a href="https://blog.cloudflare.com/monsters-in-the-middleboxes/"><u>monster in the middle (MITM)</u></a> attack, where an adversary intercepts your connection, establishes a separate secure QKD link to you and your intended destination, and then sits in the middle reading and relaying all traffic. To prevent this, you must authenticate the identity of the party you are connecting to, using either <a href="https://en.wikipedia.org/wiki/Pre-shared_key"><u>pre-shared keys</u></a> or conventional public-key cryptography. The bottom line is, whether or not you invest in QKD, you still need a solution for authentication to protect against active attackers armed with quantum computers. Practically speaking, that means you need PQC, but PQC is already a standalone solution that provides both authentication and key agreement, which leads to questions of why use QKD in the first place.</p><p>Some <a href="https://www.amazon.science/blog/qkd-and-authentication-separating-facts-from-myths"><u>proponents</u></a> <a href="https://www.bluequbit.io/quantum-internet"><u>argue</u></a> that QKD should be integrated into existing systems as an extra security layer. The value proposition of QKD relates to the “<a href="https://en.wikipedia.org/wiki/Harvest_now,_decrypt_later"><u>harvest now, decrypt later</u></a>” threat. In public-key cryptography, the key exchange messages used to set up encryption keys to secure a communication channel are exchanged in full view of a potential adversary. If an adversary records the key exchange messages, they might hope to use improved techniques in the future to solve the hard math problems upon which the security of the key exchange relies, allowing them to recover the encryption keys and decrypt the communication. If encryption keys are exchanged directly via QKD instead, the eavesdropper protections provided by QKD stop an adversary from recording messages that could later allow them to recover the encryption key (e.g. by using a quantum computer or other advances in cryptanalysis). The problem is, however, that this “extra security layer” is brittle, and limited to a single physical link. As soon as the data is transmitted elsewhere — for instance at an Internet exchange point or to travel to an end-user — the QKD security ends. For the rest of its journey, the data is protected by standard protocols like <a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/"><u>TLS</u></a>, making the value of the initial QKD link questionable.</p><p>While we hope the technology progresses, QKD is neither necessary nor sufficient for security against a quantum adversary. PQC is sufficient for security against a quantum adversary, already runs on your existing hardware, and works everywhere.</p>
    <div>
      <h3>Quantum random number generators</h3>
      <a href="#quantum-random-number-generators">
        
      </a>
    </div>
    <p>Quantum random number generators (QRNGs) are a type of<a href="https://en.wikipedia.org/wiki/Hardware_random_number_generator"><u> “true” random number generator (TRNG)</u></a> that work by harnessing inherent unpredictability of quantum mechanics, for example by measuring <a href="https://en.wikipedia.org/wiki/Radioactive_decay"><u>atomic decay</u></a> or shooting photons at a <a href="https://en.wikipedia.org/wiki/Beam_splitter"><u>beam splitter</u></a>. Other types of classical (non-quantum) TRNGs use physical phenomena that exhibit random properties, such as <a href="https://ieeexplore.ieee.org/abstract/document/982700"><u>thermal noise</u></a> from electrical components, the motion of hot wax in <a href="https://blog.cloudflare.com/randomness-101-lavarand-in-production/"><u>lava lamps</u></a>, <a href="https://blog.cloudflare.com/harnessing-office-chaos/#londons-unpredictable-pendulums"><u>double pendulums</u></a>, <a href="https://blog.cloudflare.com/harnessing-office-chaos/#austins-mesmerizing-mobiles"><u>hanging mobiles</u></a>, or <a href="https://blog.cloudflare.com/chaos-in-cloudflare-lisbon-office-securing-the-internet-with-wave-motion/"><u>water wave machines</u></a>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6hDsBCSgInfwiAP7Qlnmth/8c1601c30a8982a164edfd096a3792a6/image_-_2025-09-19T141347.781.png" />
          </figure><p>In cryptography and computer security, the essential property required from a random number generator is that the outputs are unpredictable and unbiased. This can be achieved by taking a small seed (say, 256 bits) of true randomness and feeding it to a cryptographically-secure pseudorandom number generator (CSPRNG) to produce an essentially limitless stream of pseudorandom output indistinguishable from true randomness. The randomness used to seed the CSPRNG can be based on either classical or quantum physical processes, as long as it is not known to the adversary. Whether or not you use a QRNG to generate the seed, a CSPRNG is essential for cryptographic applications.</p><p>We are the first to get excited about <a href="https://blog.cloudflare.com/randomness-101-lavarand-in-production/"><u>fun</u></a> <a href="https://blog.cloudflare.com/chaos-in-cloudflare-lisbon-office-securing-the-internet-with-wave-motion/"><u>new</u></a> <a href="https://blog.cloudflare.com/harnessing-office-chaos/"><u>sources</u></a> of <a href="https://blog.cloudflare.com/league-of-entropy/"><u>randomness</u></a>. However, we’d like to emphasize that randomness derived from quantum effects is not necessary to combat threats from quantum computers. Quantum computers do not enable any practical new attacks against classical TRNGs in widespread use today. Your decision to invest in QRNGs should be based on a perceived improvement in the quality of randomness they produce and not on a perceived threat to classical TRNGs from quantum computing.</p>
    <div>
      <h2>Post-quantum cryptography at Cloudflare</h2>
      <a href="#post-quantum-cryptography-at-cloudflare">
        
      </a>
    </div>
    <p>Cloudflare has been at the forefront of developing and deploying PQC, and we are committed to making PQC available <a href="https://blog.cloudflare.com/post-quantum-crypto-should-be-free"><u>for free and by default</u></a> for all of our products. And we run it at scale — already <a href="https://radar.cloudflare.com/explorer?dataSet=http&amp;groupBy=post_quantum&amp;filters=botClass%253DLIKELY_HUMAN&amp;dt=1d"><u>over 40% of the human-generated traffic</u></a> to our network uses PQC.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1UaPlayxwXxE9cKVZAVAQR/d605e06ae2a173c8344c1def89d64b1c/image_-_2025-09-19T141341.648.png" />
          </figure><p>So what’s in that 40%? PQC is supported for all <a href="https://developers.cloudflare.com/ssl/post-quantum-cryptography/"><u>website and API traffic</u></a> served through Cloudflare, most of Cloudflare’s <a href="https://blog.cloudflare.com/post-quantum-cryptography-ga"><u>internal network traffic</u></a>, and traffic running over our <a href="https://blog.cloudflare.com/post-quantum-zero-trust/"><u>Zero-Trust platform</u></a>. All these connections use post-quantum key agreement to protect against the “<a href="https://en.wikipedia.org/wiki/Harvest_now,_decrypt_later"><u>harvest now, decrypt later</u></a>” threat, where an adversary intercepts and stores encrypted data today with the hope of decrypting with a quantum computer or other cryptanalytic advances in the future. Key agreement is an important first step, but there’s still more work to be done. We’re <a href="https://mailarchive.ietf.org/arch/msg/ietf-announce/OWIjlOTCI_PIO0S2O9NHj8YUY0I/"><u>actively working</u></a> with stakeholders in the industry to prepare for the upcoming migration to post-quantum signatures to prevent active impersonation attacks from quantum adversaries (after Q-day).</p>
    <div>
      <h2>Quantum readiness strategy</h2>
      <a href="#quantum-readiness-strategy">
        
      </a>
    </div>
    <p>If purchasing quantum hardware is not necessary, how <i>should</i> organizations <a href="https://www.cloudflare.com/the-net/quantum-computing/"><u>prepare for a quantum future</u></a>? The most effective strategy will depend on your organization’s individual needs, but some general strategies will pay off for most organizations:</p><p>Investing in basic security practices is a good start. Hire the right expertise if you don’t already have it. Find vendors that support post-quantum encryption in their offerings today, and whose products are cryptographically agile so you can enjoy a seamless transition to <a href="https://blog.cloudflare.com/another-look-at-pq-signatures/"><u>post-quantum signatures</u></a> and certificates when the industry migrates before Q-day. Follow a tunneling strategy: routing application traffic over the Internet via <a href="https://developers.cloudflare.com/ssl/post-quantum-cryptography/pqc-and-zero-trust/"><u>secure quantum safe tunnels</u></a> allows you to reduce your attack surface area with minimal changes to existing systems. If you’re already a Cloudflare customer (or want to be), our <a href="https://www.cloudflare.com/application-services/products/cdn/"><u>Content Distribution Network</u></a> and <a href="https://blog.cloudflare.com/post-quantum-zero-trust/"><u>Zero Trust platform</u></a> makes this easy. Learn more about how we can help at our <a href="https://www.cloudflare.com/pqc"><u>Post-Quantum Cryptography</u></a> webpage.</p> ]]></content:encoded>
            <category><![CDATA[Post-Quantum]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Randomness]]></category>
            <category><![CDATA[Research]]></category>
            <guid isPermaLink="false">3X7BJlPGwok0pKcR33AUs0</guid>
            <dc:creator>Luke Valenta</dc:creator>
        </item>
        <item>
            <title><![CDATA[Chaos in Cloudflare’s Lisbon office: securing the Internet with wave motion]]></title>
            <link>https://blog.cloudflare.com/chaos-in-cloudflare-lisbon-office-securing-the-internet-with-wave-motion/</link>
            <pubDate>Mon, 17 Mar 2025 12:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare is now using a wall of waves in our Lisbon, Portugal office to create entropy and strengthen Internet security, turning liquid chaos into secure, unpredictable encryption. ]]></description>
            <content:encoded><![CDATA[ <p>Over the years, Cloudflare has gained fame for many things, including our technical blog, but also as <a href="https://www.wired.com/story/cloudflare-lava-lamps-protect-from-hackers/"><u>a tech company securing the Internet using </u><b><u>lava lamps</u></b></a>, a story that began as a research/science project almost 10 years ago. In March 2025, we added another layer to its legacy: a "wall of entropy" made of 50 <b>wave machines </b>in constant motion at our Lisbon office, the company's European HQ. </p><p>These wave machines are a new source of entropy, joining <b>lava lamps</b> in San Francisco, <b>suspended rainbows</b> in Austin, and <b>double chaotic pendulums </b>in London. The entropy they generate contributes to securing the Internet <a href="#lavarand-origins-and-walls-of-entropy"><u>through LavaRand</u></a>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6sp4ZXYnpwUGAabVB0fRKW/f56edd916efeb49173c623e99b87bc70/DSC00336.JPG" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1D1cayhBpPyuUNKV4JCcvF/e6d493a71e41c3622dd4f895505a3f43/DSC00450.JPG" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/EE2gOFRrXCGM5ASh3uCl7/b282e0ed651cb5c354b183bc33aff116/image4.jpg" />
          </figure><p><sup><i>The new waves wall at Cloudflare’s Lisbon office sits beside the Radar Display of global Internet insights, with the 25th of April Bridge overlooking the Tagus River in the background.</i></sup></p><p>It’s exciting to see waves in Portugal now playing a role in keeping the Internet secure, especially given Portugal’s deep maritime history.</p><p>The installation honors Portugal’s passion for the sea and exploration of the unknown, famously beginning over 600 years ago, in 1415, with pioneering vessels like <a href="https://en.wikipedia.org/wiki/Caravel"><u>caravels</u></a> and naus/carracks, precursors to galleons and other ships. Portuguese sea exploration was driven by navigation schools and historic voyages <i>“through seas never sailed before”</i> (<i>“Por mares nunca dantes navegados” </i>in Portuguese), as described by Portugal’s famous poet, Luís Vaz de Camões, born 500 years ago (1524).</p><p>Anyone familiar with Portugal knows the <a href="https://en.wikipedia.org/wiki/History_of_Portugal#Naval_exploration_and_Portuguese_Empire_(15th%E2%80%9316th_centuries)"><u>sea is central</u></a> to its identity. The small country has 980 km of coastline, where most of its main cities are located. Maritime areas make up 90% of its territory, including the mid-Atlantic Azores. In 1998, Lisbon’s <a href="https://en.wikipedia.org/wiki/Expo_%2798"><u>Expo 98</u></a> celebrated the oceans and this maritime heritage. Since 2011, the small town of Nazaré also became globally <a href="https://allwaves.surf/waves-explained-nazare/"><u>famous among the surfing community</u></a> for its <a href="https://earthobservatory.nasa.gov/images/149486/monster-waves-of-nazare"><u>giant waves</u></a>.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2zN2XfhmWnjbFmkXfTiYGw/fa321c61b54e676136f93d050364ee8b/image6.jpg" />
          </figure>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Tyu4Wlgn1NMihceYSCUvI/45905ee3820880371b508dc13c32f11b/image2.jpg" />
          </figure><p><sup><i>Nazaré’s waves, famous since Garrett McNamara’s 23.8 m (78 ft) ride in 2011, hold </i></sup><a href="https://www.guinnessworldrecords.com/world-records/78115-largest-wave-surfed-unlimited"><sup><i><u>Guinness World Records</u></i></sup></a><sup><i> for the biggest waves ever surfed. Photos: Sam Khawasé &amp; Beatriz Paula, from Cloudflare.</i></sup></p><p>Portugal’s maritime culture also inspired literature and music, including poet Fernando Pessoa, who referenced it in his 1934 book <a href="https://en.wikipedia.org/wiki/Mensagem"><u>Mensagem</u></a>, and musician Rui Veloso, who dedicated his 1990s album <a href="https://open.spotify.com/album/2mzMuD3bxwFaFgfjU2vigY"><u>Auto da Pimenta</u></a> to Portugal’s historic connection to the sea.</p>
    <div>
      <h3>How this chaos came to be</h3>
      <a href="#how-this-chaos-came-to-be">
        
      </a>
    </div>
    <p>As Cloudflare’s CEO, Matthew Prince, <a href="https://x.com/eastdakota/status/1899226252956827846"><u>said</u></a> recently, this new wall of entropy began with an idea back in 2023: “What could we use for randomness that was like our lava lamp wall in San Francisco but represented our team in Portugal?”</p><p>The original inspiration came from wave motion machine desk toys, which were popular among some of our team members. Waves and the ocean not only provide a source of movement and randomness, but also align with Portugal’s maritime history and the office’s scenic view.</p><p>However, this was easier said than done. It turns out that making a wave machine wall is a real challenge, given that these toys are not as popular as they were in the past,  and aren’t being manufactured in the size we needed any more. We scoured eBay and other sources but couldn't find enough, consistent in style and in working order wave machines. We also discovered that off-the-shelf models weren’t designed to run 24/7, which was a critical requirement for our use.</p>
    <div>
      <h4>Artistry to create wave machines</h4>
      <a href="#artistry-to-create-wave-machines">
        
      </a>
    </div>
    <p>Undaunted, <a href="https://blog.cloudflare.com/cloudflare-top-100-most-loved-workplaces-in-2022"><u>Cloudflare’s Places team</u></a>, which ensures our offices reflect our values and culture, found a <a href="https://wavemotionmachines.com/"><u>U.S.-based artisan</u></a> that specializes in ocean wave displays to create the wave machines for us. Since 2009, his one-person business, <a href="https://wavemotionmachines.com/"><u>Hughes Wave Motion Machines</u></a>, has blended artistry, engineering, and research, following his transition from Lockheed Martin Space Systems, where he designed military and commercial satellites.</p><div>
  
</div>
<p></p><p><sup><i>Timelapse of the mesmerizing office waves, set to the tune of an AI-generated song.</i></sup></p><p>Collaborating closely, we developed a custom rectangular wave machine (18 inches/45 cm long) that runs nonstop — not an easy task — which required hundreds of hours of testing and many iterations. Featuring rotating wheels, continuous motors, and a unique fluid formula, these machines create realistic ocean-like waves in green, blue, and Cloudflare’s signature orange. </p><p>Here’s a quote from the artist himself about these wave machines:</p><blockquote><p><i>“The machine’s design is a balancing act of matching components and their placement to how the fluid responds in a given configuration. There is a complex yet delicate relationship between viscosity, specific gravity, the size and design of the vessel, and the placement of each mechanical interface. Everything must be precisely aligned, centered around the fluid like a mathematical function. I like to say it’s akin to ’balancing a checkerboard on a beach ball in the wind.’”</i></p></blockquote>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3K9fpTU0D0xi831MHFOFBj/570b8c307fea1078f3c0262e13447bf6/image7.jpg" />
          </figure><p><sup><i>The Cloudflare Places Team with Lisbon office architects and contractor testing wave machine placement, shelves, lighting, and mirrors to enhance movement and reflection, March 2024.</i></sup></p><p>Despite delays, the Lisbon wave machines finally debuted on March 10, 2025 — an incredibly exciting moment for the Places team.</p><p><b>Some numbers about our wave-machine entropy wall:</b></p><ul><li><p>50 wave machines, 50 motion wheels &amp; motors, 50 acrylic containers filled with Hughes Wave Fluid Formula (two <a href="https://www.sciencedirect.com/topics/engineering/immiscible-liquid"><u>immiscible liquids</u></a>)</p></li><li><p>3 liquid colors: blue, green, and orange</p></li><li><p>15 months from concept to completion</p></li><li><p>14 flips (side-to-side balancing movements) per minute — over 20,000 per day</p></li><li><p>Over 15 waves per minute</p></li><li><p>~0.5 liters of liquid per machine</p></li></ul>
    <div>
      <h3>LavaRand origins and walls of entropy</h3>
      <a href="#lavarand-origins-and-walls-of-entropy">
        
      </a>
    </div>
    <p>Cloudflare’s servers handle 71 million HTTP requests per second on average, with 100 million HTTP requests per second at peak. <a href="https://radar.cloudflare.com/adoption-and-usage#http-vs-https"><u>Most of these requests are secured via TLS</u></a>, which relies on secure randomness for cryptographic integrity. A Cryptographically Secure Pseudorandom Number Generator (<a href="https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/"><u>CSPRNG</u></a>) ensures unpredictability, but only when seeded with high-quality entropy. Since chaotic movement in the real world is truly random, Cloudflare designed a system to harness it. Our <a href="https://blog.cloudflare.com/harnessing-office-chaos/"><u>2024 blog post</u></a> expands on this topic in a more technical way, but here’s a quick summary.</p><p>In <a href="https://blog.cloudflare.com/randomness-101-lavarand-in-production/"><u>2017</u></a>, Cloudflare launched LavaRand, inspired by <a href="https://www.wired.com/1997/03/lava-lites-easy-to-break-hard-to-crack/"><u>Silicon Graphics’ 1997 concept</u></a> However, the need for randomness in security was already a hot topic on our blog before that, such as in our discussions of <a href="https://blog.cloudflare.com/why-randomness-matters/"><u>securing systems</u></a> and <a href="https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/"><u>cryptography</u></a>. Originally, LavaRand collected entropy from a wall of lava lamps in our San Francisco office, feeding an internal API that servers periodically query to include in their entropy pools. Over time, we expanded LavaRand beyond lava lamps, incorporating <a href="https://blog.cloudflare.com/harnessing-office-chaos/#londons-unpredictable-pendulums"><u>new sources of office chaos</u></a> while maintaining the same core method.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2v6Wvde8j8R7482QjBsSrV/89b37c652654e27c13d328e9acac6489/image9.png" />
          </figure><p>A camera captures images of dynamic, unpredictable randomness displays. Shadows, lighting changes, and even sensor noise contribute entropy. Each image is then processed into a compact hash, converting it into a sequence of random bytes. These, combined with the previous seed and local system entropy, serve as input for a Key Derivation Function (<a href="https://en.wikipedia.org/wiki/Key_derivation_function"><u>KDF</u></a>), which generates a new seed for a CSPRNG — capable of producing virtually unlimited random bytes upon request. The waves in our Lisbon office are now contributing to this pool of randomness.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1XFFjr4jhRMQlz6akHKZm4/44759c4e879de3792cd21b4ce2525c90/image5.png" />
          </figure><p>Cloudflare’s LavaRand API makes this randomness accessible internally, strengthening cryptographic security across our global infrastructure. For example, when you use <i>Math.random()</i> in <a href="https://workers.cloudflare.com/"><u>Cloudflare Workers</u></a>, part of that randomness comes from LavaRand. Similarly, querying our <a href="https://blog.cloudflare.com/harnessing-office-chaos/#drand-distributed-and-verifiable-public-randomness"><u>drand API</u></a> taps into LavaRand as well. Cloudflare offers this API to enable anyone to generate random numbers and even seed their own systems.</p>
    <div>
      <h3>Our new Lisbon office space</h3>
      <a href="#our-new-lisbon-office-space">
        
      </a>
    </div>
    
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5ivPkCfTkGxfo6Swt6p9qY/e7414a14b88bef7ac7e0ef6f737b58c6/image8.jpg" />
          </figure><p><sup><i>Photo of the view from our Lisbon office, featuring ceiling lights arranged in a wave-like pattern.</i></sup></p><p>Entropy also inspired the design ethos of our new Lisbon office, given that the wall of waves and the office are part of the same project. As soon as you enter, you're greeted not only by the motion of the entropy wall but also by the constant movement of planet Earth on our Cloudflare Radar Display screen that stands next to it. But the waves don’t stop there — more elements throughout the space mimic the dynamic flow of the Internet itself. Unlike ocean tides, however, Internet traffic ebbs and flows with the motion of the Sun, not the Moon.</p><p>As you walk through the office, waves are everywhere — in the ceiling lights, the architectural contours, and even the floor plan, thoughtfully designed by our architect to reflect the fluid movement of water. The visual elements create a cohesive experience, reinforcing a sense of motion. Each meeting room embraces this maritime theme, named after famous Portuguese beaches — including, naturally, Nazaré.</p><p>We partnered with an incredible group of local Portuguese vendors for this construction project, where all the leads were women — something incredibly rare for the industry. The local teams worked with passion, proudly wore Cloudflare t-shirts, and fostered a warm, family-like atmosphere. They openly expressed pride in the project, sharing how it stood out from anything they had worked on before.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7lpuurEtWfpIPKvHVqmD0L/0b0561097859f286d6b5e98db82f1e0f/image3.jpg" />
          </figure><p><sup><i>Our amazing third-party team and internal Places team, proudly rocking Cloudflare shirts after bringing this project to life.</i></sup></p>
    <div>
      <h3>Help us select a name for our new wall of entropy</h3>
      <a href="#help-us-select-a-name-for-our-new-wall-of-entropy">
        
      </a>
    </div>
    <p>Next, we have several name options for this new wall of entropy. Help us decide the best one, and register your vote using <a href="https://forms.gle/L2gAqoJTwQmJFkmy8"><u>this form</u></a>.</p><blockquote><p><b>The Surf Board</b></p><p><b>Chaos Reef</b></p><p><b>Waves of Entropy</b></p><p><b>Wall of Waves</b></p><p><b>Whirling Wave Wall</b></p><p><b>Chaotic Wave Wall</b></p><p><b>Waves of Chaos</b></p></blockquote><p>If you’re interested in working in Cloudflare’s Lisbon office, we’re hiring! Our <a href="https://www.cloudflare.com/careers/jobs/"><b><u>career page</u></b></a> lists our open roles in Lisbon, as well as our other locations in the U.S., Mexico, Europe and Asia.</p><p><sup><i>Acknowledgements: This project was only possible with the effort, vision and help of John Graham-Cumming, Caroline Quick, Jen Preston, Laura Atwall, Carolina Beja, Hughes Wave Motion Machines, P4 Planning and Project Management, Gensler Europe, Openbook Architecture, and Vector Mais.</i></sup></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Randomness]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Portugal]]></category>
            <category><![CDATA[Life at Cloudflare]]></category>
            <category><![CDATA[Lisbon]]></category>
            <category><![CDATA[Offices]]></category>
            <guid isPermaLink="false">1QYrEI6OwTmFuhZNnURL95</guid>
            <dc:creator>João Tomé</dc:creator>
            <dc:creator>Caroline Quick</dc:creator>
        </item>
        <item>
            <title><![CDATA[How Cloudflare and Wall Street Are Helping Encrypt the Internet Today]]></title>
            <link>https://blog.cloudflare.com/how-cloudflare-and-wall-street-are-helping-encrypt-the-internet-today/</link>
            <pubDate>Fri, 13 Sep 2019 23:00:00 GMT</pubDate>
            <description><![CDATA[ Today has been a big day for Cloudflare, as we became a public company on the New York Stock Exchange (NYSE: NET). To mark the occasion, we decided to bring our favorite entropy machines to the floor of the NYSE. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Today has been a big day for Cloudflare, as we became a public company on the New York Stock Exchange (NYSE: NET). To mark the occasion, we decided to bring our favorite entropy machines to the floor of the NYSE. Footage of these lava lamps is being used as an additional seed to our <a href="/randomness-101-lavarand-in-production/"><b>entropy-generation system LavaRand</b></a> — bolstering Internet encryption for over 20 million Internet properties worldwide.</p><p><i>(This is mostly for fun. But when’s the last time you saw a lava lamp on the trading floor of the New York Stock Exchange?)</i></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2g2vH1hZmjN2EcjCIV8wfi/94702da9614d3dd97ddae35c5f8eeff8/NYSE-Lava-Lamps-Cropped.jpg" />
            
            </figure><p>A little context: generating truly random numbers using computers is impossible, because code is inherently deterministic (i.e. predictable). To compensate for this, engineers draw from pools of randomness created by entropy generators, which is a fancy term for "things that are truly unpredictable".</p><p>It turns out that lava lamps are fantastic sources of entropy, as was first shown by Silicon Graphics in the 1990s. It’s a torch we’ve been proud to carry forward: today, Cloudflare uses lava lamps to generate entropy that helps make millions of Internet properties more secure.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/ah3LRVUaM1zY6dND64ghZ/18ce5b07b000d6d951d97cc5753abe81/LavaRand1.png" />
            
            </figure><p>Housed in our San Francisco headquarters is a wall filled with dozens of lava lamps, undulating with mesmerizing randomness. We capture these lava lamps on video via a camera mounted across the room, and feed the resulting footage into an algorithm — called <a href="/lavarand-in-production-the-nitty-gritty-technical-details/"><b>LavaRand</b></a> — that amplifies the pure randomness of these lava lamps to dizzying extremes (computers can't create seeds of pure randomness, but they can massively amplify them).</p><p>Shortly before we rang the opening bell this morning, we recorded footage of our lava lamps in operation on the trading room floor of the New York Stock Exchange, and we're ingesting the footage into our LavaRand system. The resulting entropy is mixed with the myriad additional sources of entropy that we leverage every day, creating a cryptographically-secure source of randomness — fortified by Wall Street.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2i4n94z75iXaoZZFgXxg7y/f8cb4be9c50b4b4ff48b3f3aff354ff7/League-Of-Entropy.png" />
            
            </figure><p>We recently took our enthusiasm for randomness a step further by facilitating the <a href="/league-of-entropy/"><b>League of Entropy</b></a>, a consortium of global organizations and individual contributors, generating verifiable randomness via a globally distributed network. As one of the founding members of the League, LavaRand (pictured above) plays a key role in empowering developers worldwide with a pool of randomness with extreme entropy and high reliability.</p><p>And today, she’s enjoying the view from the podium!</p><hr /><p><i>One caveat: the lava lamps we run in our San Francisco headquarters are recorded in real-time, 24/7, giving us an ongoing stream of entropy. For reasons that are understandable, the NYSE doesn't allow for live video feeds from the exchange floor while it is in operation. But this morning they did let us record footage of the lava lamps operating shortly before the opening bell. The video was recorded and we're ingesting it into our LavaRand system (alongside many other entropy generators, including the lava lamps back in San Francisco).</i></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Encryption]]></category>
            <guid isPermaLink="false">5cmkZ6Tia2iUD2yBBnQAOb</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
        <item>
            <title><![CDATA[League of Entropy: Not All Heroes Wear Capes]]></title>
            <link>https://blog.cloudflare.com/league-of-entropy/</link>
            <pubDate>Mon, 17 Jun 2019 13:01:00 GMT</pubDate>
            <description><![CDATA[ Everything from cryptography to big money lottery to quantum mechanics requires some form of randomness. But what exactly does it mean for a number to be randomly generated and where does the randomness come from? ]]></description>
            <content:encoded><![CDATA[ <p></p><p>To kick-off <a href="/welcome-to-crypto-week-2019/">Crypto Week 2019</a>, we are really excited to announce a new solution to a long-standing problem in cryptography. To get a better understanding of the technical side behind this problem, please refer to the next <a href="/inside-the-entropy">post</a> for a deeper dive.</p><p>Everything from cryptography to big money lottery to <a href="https://arxiv.org/pdf/1611.02176.pdf">quantum mechanics</a> requires some form of randomness. But what exactly does it mean for a number to be randomly generated and where does the randomness come from?</p><p>Generating randomness dates back three thousand years, when the ancients rolled “the bones” to determine their fate. Think of lotteries-- seems simple, right? Everyone buys their tickets, chooses six numbers, and waits for an official to draw them randomly from a basket. Sounds like a foolproof solution. And then in 1980, the host of the Pennsylvania lottery drawing was <a href="https://www.nytimes.com/1981/05/21/us/2-guilty-of-bid-to-rig-pennsylvania-lottery.html">busted for using weighted balls</a> to choose the winning number. This lesson, along with the need of other complex systems for generating random numbers spurred the creation of random number generators.</p><p>Just like a lottery game selects random numbers unpredictably, a random number generator is a device or software responsible for generating sequences of numbers in an unpredictable manner. As the need for randomness has increased, so has the need for constant generation of substantially large, unpredictable numbers. This is why organizations developed <a href="https://csrc.nist.gov/Projects/Interoperable-Randomness-Beacons">publicly available randomness beacons</a> -- servers generating completely unpredictable 512-bit strings (about 155-digit numbers) at regular intervals.</p><p>Now, you might think using a randomness beacon for random generation processes, such as those needed for lottery selection, would make the process resilient against adversarial manipulation, but that’s not the case. Single-source randomness has been exploited to generate biased results.</p><p>Today, randomness beacons generate numbers for lotteries and election audits -- both affect the lives and fortunes of millions of people. Unfortunately, exploitation of the single point of origin of these beacons have created dishonest results that benefited one <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-iowa-lottery-fraud-mystery.html">corrupt insider</a>. To thwart exploitation efforts, Cloudflare and other randomness-beacon providers have joined forces to bring users a <b>quorum of decentralized randomness beacons</b>. After all, eight independent globally distributed beacons can be much more trustworthy than one!</p><p>We’re happy to introduce you to ....</p><p>THE LEAGUE …. OF …. ENTROPY !!!!!!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3u6pMN9g1KQu3ZvwMTwkmb/d90c484cfb789a728cd8fdcc0f002324/image8-1.png" />
            
            </figure>
    <div>
      <h3>What is a randomness beacon?</h3>
      <a href="#what-is-a-randomness-beacon">
        
      </a>
    </div>
    <p>A randomness beacon is a public service that provides unpredictable random numbers at regular intervals.</p><p><a href="https://github.com/dedis/drand">drand</a> (pronounced dee-rand) is a <i>distributed randomness</i> beacon developed by <a href="https://twitter.com/nikkolasg1">Nicolas Gailly</a>; with the help of <a href="https://twitter.com/daeinar">Philipp Jovanovic</a>, and <a href="https://github.com/PizzaWhisperer">Mathilde Raynal</a>. The drand project originated from the research paper <a href="https://www.ieee-security.org/TC/SP2017/papers/413.pdf">Scalable Bias-Resistant Distributed Randomness</a> published at the <a href="https://ieeexplore.ieee.org/abstract/document/7958592">2017 IEEE Symposium on Security and Privacy</a> by <a href="http://ewa.syta.us/">Ewa Syta</a>, <a href="https://philipp.jovanovic.io">Philipp Jovanovic</a>, <a href="https://lefteriskk.github.io/">Eleftherios Kokoris Kogias</a>, <a href="https://github.com/nikkolasg/">Nicolas Gailly</a>, <a href="https://people.epfl.ch/linus.gasser">Linus Gasser</a>, <a href="https://ismailkhoffi.com/">Ismail Khoffi</a>, <a href="http://www.cs.yale.edu/homes/fischer/">Michael J. Fischer</a>, <a href="https://bford.info/">Bryan Ford</a>, from the <a href="https://dedis.epfl.ch/">Decentralized/Distributed Systems (DEDIS) lab</a> at <a href="https://www.epfl.ch/">EPFL</a>, <a href="https://www.yale.edu/">Yale University</a>, and <a href="https://www.trincoll.edu/">Trinity College Hartford</a>, with support from <a href="https://researchinstitute.io/">Research Institute</a>.</p><p>For every randomness generation round, drand provides the following properties, as specified in the <a href="https://www.ieee-security.org/TC/SP2017/papers/413.pdf">research paper</a>:</p><ul><li><p><b>Availability</b> - The distributed randomness generation completes successfully with high probability.</p></li><li><p><b>Unpredictability</b> - No party learns anything about the random output of the current round, except with negligible probability, until a sufficient number of drand nodes reveals their contributions in the randomness generation protocol.</p></li><li><p><b>Unbiasability</b> - The random output represents an unbiased, uniformly random value, except with negligible probability.</p></li><li><p><b>Verifiability</b> - The random output is third-party verifiable against the collective public key computed during drand's setup. This serves as the unforgettable attestation that the documented set of drand nodes ran the protocol to produce the one-and-only random output, except with negligible probability.</p></li></ul><p><i>Entropy</i> measures the unpredictable nature of a number. For randomness, the more entropy the better, so naturally it’s where we got our name, the League of Entropy.</p><p>Our founding members are contributing their individual high-entropy sources to provide a more random and unpredictable beacon to generate publicly verifiable random values every sixty seconds. The fact that the drand beacon is decentralized and built using appropriate, provably-secure cryptographic primitives, increases our confidence that it possesses all the aforementioned properties.</p><p>This global network of servers generating randomness ensures that even if a few servers are offline, the beacon continues to produce new numbers by using the remaining online servers.  Even if one or two of the servers or their entropy sources were to be compromised, the rest will still ensure that the jointly-produced entropy is fully unpredictable and unbiasable.</p><p>Who exactly is running this beacon? Currently, The League of Entropy is a consortium of global organizations and individual contributors, including: Cloudflare, Protocol Labs researcher Nicolas Gailly, University of Chile, École polytechnique fédérale de Lausanne  (EPFL), Kudelski Security, and EPFL researchers, Philipp Jovanovic and Ludovic Barman.</p>
    <div>
      <h3>Meet the League of Entropy</h3>
      <a href="#meet-the-league-of-entropy">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/BWt5ZDGMydRLWX7xttadU/47daf5fed2017f4359b6354938faca5d/image4-3.png" />
            
            </figure><p>Cloudflare’s <b>LavaRand</b>: <a href="/lavarand-in-production-the-nitty-gritty-technical-details/">LavaRand</a> sources her high entropy from Cloudflare’s wall of lava lamps at our San Francisco Headquarters. The unpredictable flow of “lava” inside the lamps is used as an input to a camera feed into a CSPRNG (Cryptographically Secure PseudoRandom Number Generator) that generates the random value.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1rPgrKMIvEhDQcA9mb96Xg/69c52f8b49ab3d5f4a75097db174491c/3R-uEem_pwlr_yfXEVJJiub0eiVTPEX01rBof0SB1xopcgbzgfOFsH4BLRXKfdnwqpAkXlJbBFG6PUQRBK-UJBqTEGIFKQxQaRaq-5FoZG8ny6WhkahwAMjSTD9X.png" />
            
            </figure><p><a href="https://www.epfl.ch">EPFL</a>’s <b>URand</b>: URand’s power comes from the local randomness generator present on every computer at /dev/urandom. The randomness input is collected from inputs such as keyboard presses, mouse clicks, network traffic, etc. URand bundles these random inputs to produce a continuous stream of randomness.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2MG8iT5EJUNbvBMRnIs0jL/5e874cbd8522463cd841550a3ce6a735/image5-2.png" />
            
            </figure><p><a href="https://random.uchile.cl/en/">UChile</a>’s <b>Seismic Girl</b>: Seismic Girl extracts super verifiable randomness from five sources queried every minute. These sources include: seismic measurements of shakes and earthquakes in Chile; a stream from a local radio station; a selection of Twitter posts; data from the Ethereum blockchain; and their own off-the-shelf RNG card.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3yqHoYjeD9Bc2rqw64Z0AI/2b2913dc2ffbcf95bca4c91e7b43db40/Sg4AYv1L_bjeQyXri7ksWM9w13hQrghD-seBI2ErHx_k4XL5Cm0f2xXZsvDRNEu3ZQCX0klZevk8Y6U3BdS_XU7AaC1VWYeL34ZSjSa1fZXKYg1I7AP6IaxkmAOH.png" />
            
            </figure><p><a href="https://www.kudelskisecurity.com/">Kudelski Security</a>’s <b>ChaChaRand</b>: ChaChaRand uses a CRNG (Cryptographic Random Number Generator) based on the <a href="https://tools.ietf.org/html/rfc7539">ChaCha20</a> stream cipher.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6wjCZoEtdvwmp3n89CMvgM/7aaf481355bad193d251013c1b8466fc/image3-3.png" />
            
            </figure><p><a href="https://protocol.ai/">Protocol Labs</a>’ <b>InterplanetaryRand</b>: InterplanetaryRand uses the power of entropy to ensure protocol safety across space and time by using environmental noise and the Linux PRNG, supplemented by CPU-sourced randomness (<a href="/ensuring-randomness-with-linuxs-random-number-generator/">RdRand</a>).</p><p>Together, our heroes are committed to #savetheinternet by combining their randomness to form a globally distributed and cryptographically verifiable randomness beacon.  </p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/oq8NHvjmXXlKoLJrhmDq9/63750368c5a8c280e05365de5789bef2/pTiFdLtxsabqbVpczCBKVT4dzbP9e9WxeU4lOPbiUIecOR5ER9QlRZG196PfYvJvF_Sbm-DTlUphCBWBMIOtqiTTKmTmRDumoCUlges8uEmNxJh75unUdnP2xobX.png" />
            
            </figure>
    <div>
      <h3>Public versus Private Randomness</h3>
      <a href="#public-versus-private-randomness">
        
      </a>
    </div>
    <p>Different types of randomness are needed for different types of applications.</p><p>The trick to generating secure cryptographic keys is to use large, privately-generated random numbers that no one else can predict. With randomness beacons publicly generating and announcing random numbers, <b>users should NOT be using the output of a randomness beacon for their secret keys</b>, as these numbers are accessible by anyone. If an attacker can guess the random number that a user’s private cryptographic key was derived from, they can crack their system and decrypt confidential information. This simply means that random numbers generated by a public beacon are not safe to use for encryption keys: not because there’s anything wrong with the randomness, but simply because the randomness is public.</p><p>Clients using the drand beacon can request private randomness from some or all of the drand nodes if they would like to generate a random value that will not be publicly announced.  For more information on how to do this, check the <a href="https://developers.cloudflare.com/randomness-beacon/">developer docs.</a></p><p>On the other hand, public randomness is often employed by users requiring a randomness value that is not supposed to be secret but whose generation must be transparent, fair, and unbiased. This is perfect for many purposes such as games, lotteries, and election auditing, where the auditor and the public require transparency into when and how and how fairly the random value was generated.The League of Entropy provides <b>public randomness</b> that any user can retrieve from <a href="https://leagueofentropy.com">leagueofentropy.com</a>. Users will be able to view the 512-bit string value that is generated every 60 seconds. Why 60 seconds? No particular reason. Theoretically, the randomness generation can go as fast as the hardware allows, but it’s not necessary for most use cases. Values generated every 60 seconds give users 1440 random values in one 24-hour period.</p><p>*FRIENDLY REMINDER: THIS RANDOMNESS IS PUBLIC. DO NOT USE IT FOR PRIVATE CRYPTOGRAPHIC KEYS*</p>
    <div>
      <h3>Why does public randomness matter?</h3>
      <a href="#why-does-public-randomness-matter">
        
      </a>
    </div>
    
    <div>
      <h4>Election auditing</h4>
      <a href="#election-auditing">
        
      </a>
    </div>
    <p>In the US, most elections are followed by an audit to verify they were unbiased and conducted fairly. Robust auditing systems increase voter confidence by improving election officials’ ability to respond effectively to allegations of fraud, and to detect bugs in the system.</p><p>Currently, most election ballots and precincts are randomly chosen by election officials. This approach is potentially vulnerable to bias by a corrupt insider who might select certain precincts to present a preferred outcome. Even in a situation where every voter district was tampered with, by using a robust, distributed, and most importantly, <i>unpredictable and unbiasable</i> beacon, election auditors can trust that a small sample of districts is enough to audit, as long as an attacker cannot predict district selection.</p><p>In Chile, election poll workers are randomly selected from a pool of eligible voters. The University of Chile’s Random UChile <a href="https://random.uchile.cl/en/">project</a> has been working on a prototype that uses their randomness beacon for this process. Alejandro Hevia, leader of Random UChile, believes that for election auditing, public randomness is important for transparency and distributed randomness gives people the ability to trust the unlikeliness that <i>multiple</i> contributors to the beacon colluded, as opposed to trusting a single entity.</p>
    <div>
      <h4>Lotteries</h4>
      <a href="#lotteries">
        
      </a>
    </div>
    <p>From 2005 to 2014, the information security director for the Multi-State Lottery Association, Eddie Tipton, <a href="https://www.nytimes.com/interactive/2018/05/03/magazine/money-issue-iowa-lottery-fraud-mystery.html">rigged a random number generator</a> and won the lottery <b>six</b> times!</p><p>Tipton could predict the winning numbers by skipping the standard random seeding process. He was able to insert into the function of the random number generator code that checked the date, day of the week, and time. If these three variables did not align, the random number generator used radioactive material and a Geiger counter to generate a random seed. If the variables aligned as surreptitiously programmed, which usually only happened once a year, then it would generate the seed using a 7-variable formula fed into a <a href="https://en.wikipedia.org/wiki/Mersenne_Twister">Mersenne Twister</a>, a <i>pseudo</i> random-number generator.</p><p>Tipton knew these 7 variables. He knew the small pool of numbers that might be the seed. This knowledge allowed him to predict the results of the Mersenne Twister. This is a scam which a <b>distributed randomness beacon</b> can make substantially more difficult, if not impossible.</p><p>Rob Sand, the former Iowa Assistant Attorney General and current Iowa State Auditor who prosecuted the Tipton cases, is also an advocate for improved controls. He said:</p><p><i>“There is no excuse for an industry that rakes in $80 billion in annual revenue not to use the most sophisticated, truly random means available to ensure integrity.”</i></p>
    <div>
      <h4>Distributed ledger platforms</h4>
      <a href="#distributed-ledger-platforms">
        
      </a>
    </div>
    <p>In many cryptocurrencies and blockchain-based distributed computing platforms, such as <a href="https://en.wikipedia.org/wiki/Ethereum">Ethereum</a>, there is often a need for random selection at the application layer. One solution to prevent bias for such a random selection is to use a distributed randomness beacon like drand to generate the random value. Justin Drake, researcher at the <a href="https://www.ethereum.org/">Ethereum Foundation</a>, believes "randomness from a drand-type federation could be a particularly good match for real-time decentralized applications on Ethereum such as live gaming and gambling". This is due to the possibility to deliver ultra-low latency randomness applicable for a broad range of application where public randomness is required.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4hGB9Ryb87DWFPSKjFCiQQ/5bcdf5446f0344d2c0a123226dba867c/IzxDdb91VENIgVK05HqMqA6u2mwL-pMx3GLBdxJQjCeaPSD1bGTjE3mnOyInEOgq0lyovRBghGCcDbPpWSPO4ToT2tR4aftwcLdQNVwCKn3Lghh2FkK8UbEkC63J.png" />
            
            </figure>
    <div>
      <h3>Let’s get you on drand!</h3>
      <a href="#lets-get-you-on-drand">
        
      </a>
    </div>
    <p>To learn more about the League of Entropy and how to use the distributed randomness beacon, visit <a href="https://leagueofentropy.com">https://leagueofentropy.com</a>. The website periodically displays the randomness generated by the network, and you can even see previously generated values. Go ahead, try it out!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/45QOeg172UTQopTpSz4urP/4dadd599bf2c2c1b3a447de62174eca1/30p6dmRd2omn-YRzrY7oPmYEVUwRFOo7izqymD6xvYQ9txl6hzOwachb_AkrHilkBKEr2kZu_lCGSXhJQrubJ_q1gPbf-NYu4V3o98cvIfa_bq2Ug1MLk6PrSysL.png" />
            
            </figure>
    <div>
      <h3>How to join the league:</h3>
      <a href="#how-to-join-the-league">
        
      </a>
    </div>
    <p>Want to join the league?? We’re not exclusive!</p><p>If you are an organization or an individual who is interested in contributing to the drand beacon, check out <a href="https://developers.cloudflare.com/randomness-beacon/">the developer docs</a> for more information regarding the requirements for setting up a server and joining the existing group. drand is currently in its beta release phase and an approval request must be sent to <a>leagueofentropy@googlegroups.com</a> in order to be approved as a contributing server.</p><p><b>UPDATE:</b> As of <a href="https://drand.love/blog/2020/08/10/drand-launches-v1-0/">August 2020</a>, drand is a production-grade network supporting critical use cases including Filecoin. For the most up-to-date information on the drand project and the League of Entropy, see <a href="https://drand.love/">drand.love</a>.</p>
    <div>
      <h3>Looking into the future</h3>
      <a href="#looking-into-the-future">
        
      </a>
    </div>
    <p>It only makes sense that the Internet of the future will demand unpredictable randomness beacons. The League of Entropy is out there now, creating the basis for future systems to leverage trustworthy public randomness. Our goal is to increase user trust and provide a one-stop shop for all your public entropy needs. Come, join us!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5u1TlHjajsOzmkNeIqsGoH/b881384074d8b079c0234550377f87aa/image2-4.png" />
            
            </figure> ]]></content:encoded>
            <category><![CDATA[Crypto Week]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[LavaRand]]></category>
            <guid isPermaLink="false">66MECAsvLf18mL0k238aK8</guid>
            <dc:creator>Dina Kozlov</dc:creator>
        </item>
        <item>
            <title><![CDATA[Inside the Entropy]]></title>
            <link>https://blog.cloudflare.com/inside-the-entropy/</link>
            <pubDate>Mon, 17 Jun 2019 13:00:00 GMT</pubDate>
            <description><![CDATA[ Generating random outcomes is an essential part of everyday life; from lottery drawings and constructing competitions, to performing deep cryptographic computations.  ]]></description>
            <content:encoded><![CDATA[ <p></p><blockquote><p>Randomness, randomness everywhere;Nor any verifiable entropy.</p></blockquote><p>Generating random outcomes is an essential part of everyday life; from lottery drawings and constructing competitions, to performing deep cryptographic computations. To use randomness, we must have some way to 'sample' it. This requires interpreting some natural phenomenon (such as a fair dice roll) as an event that generates some random output. From a computing perspective, we interpret random outputs as bytes that we can then use in algorithms (such as drawing a lottery) to achieve the functionality that we want.</p><p>The sampling of randomness securely and efficiently is a critical component of all modern computing systems. For example, nearly all public-key cryptography relies on the fact that algorithms can be seeded with bytes generated from genuinely random outcomes.</p><p>In scientific experiments, a random sampling of results is necessary to ensure that data collection measurements are not skewed. Until now, generating random outputs in a way that we can verify that they are indeed random has been very difficult; typically involving taking a variety of statistical measurements.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/CEsiU1gZNLRG4VZ8pKenE/4fe5ae39fa2c63683bf7db2540ad266a/image9-2.png" />
            
            </figure><p>During Crypto week, Cloudflare is releasing a new <a href="/league-of-entropy">public randomness beacon</a> as part of the launch of the <a href="https://leagueofentropy.com">League of Entropy</a>. The League of Entropy is a network of beacons that produces <i>distributed</i>, <i>publicly verifiable</i> random outputs for use in applications where the nature of the randomness must be publicly audited. The underlying cryptographic architecture is based on the <a href="https://github.com/dedis/drand">drand project</a>.</p><p>Verifiable randomness is essential for ensuring trust in various institutional decision-making processes such as <a href="/league-of-entropy">elections and lotteries</a>. There are also cryptographic applications that require verifiable randomness. In the land of decentralized consensus mechanisms, the <a href="https://dfinity.org/static/dfinity-consensus-0325c35128c72b42df7dd30c22c41208.pdf">DFINITY approach</a> uses random seeds to decide the outcome of leadership elections. In this setting, it is essential that the randomness is publicly verifiable so that the outcome of the leadership election is trustworthy. Such a situation arises more generally in <a href="https://en.wikipedia.org/wiki/Sortition">Sortitions</a>: an election where leaders are selected as a random individual (or subset of individuals) from a larger set.</p><p>In this blog post, we will give a technical overview behind the cryptography used in the distributed randomness beacon, and how it can be used to generate publicly verifiable randomness. We believe that distributed randomness beacons have a huge amount of utility in realizing the <a href="/welcome-to-crypto-week-2019/">Internet of the Future</a>; where we will be able to rely on distributed, decentralized solutions to problems of a global-scale.</p>
    <div>
      <h2>Randomness &amp; entropy</h2>
      <a href="#randomness-entropy">
        
      </a>
    </div>
    <p>A source of randomness is measured in terms of the amount of <i>entropy</i> it provides. Think about the entropy provided by a random output as a score to indicate how “random” the output actually is. The notion of information entropy was concretised by the famous scientist Claude Shannon in his paper <a href="https://en.wikipedia.org/wiki/A_Mathematical_Theory_of_Communication">A Mathematical Theory of Communication</a>, and is sometimes known as <a href="https://en.wikipedia.org/wiki/Entropy_(information_theory)"><i>Shannon Entropy</i></a>.</p><p>A common way to think about random outputs is: a sequence of bits derived from some random outcome. For the sake of an argument, consider a fair 8-sided dice roll with sides marked 0-7. The outputs of the dice can be written as the bit-strings <code>000,001,010,...,111</code>. Since the dice is fair, any of these outputs is equally likely. This is means that each of the bits is equally likely to be <code>0</code> or <code>1</code>. Consequently, interpreting the output of the dice roll as a random output then derives randomness with <code>3</code> bits of entropy.</p><p>More generally, if a perfect source of randomness guarantees strings with <code>n</code> bits of entropy, then it generates bit-strings where each bit is equally likely to be <code>0</code> or <code>1</code>. This allows us to predict the value of any bit with maximum probability <code>1/2</code>. If the outputs are sampled from such a perfect source, we consider them <i>uniformly distributed</i>. If we sample the outputs from a source where one bit is predictable with higher probability, then the string has <code>n-1</code> bits of entropy. To go back to the dice analogy, rolling a 6-sided dice provides less than <code>3</code> bits of entropy because the possible outputs are <code>000,001,010,011,100,101</code> and so the 2nd and 3rd bits are more likely to be to set to <code>0</code> than to <code>1</code>.</p><p>It is possible to mix entropy sources using specifically designed mixing functions to retrieve something with even greater entropy. The maximum resulting entropy is the sum of the entropy taken from the number of entropic sources used as input.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4LcFWOh6MsFEqmYrGB6PXa/f87eb05da963db50a5f8a0a24d260d76/combined-entropy-_2x.png" />
            
            </figure>
    <div>
      <h4>Sampling randomness</h4>
      <a href="#sampling-randomness">
        
      </a>
    </div>
    <p>To sample randomness, let’s first identify the appropriate sources. There are many natural phenomena that one can use:</p><ul><li><p>atmospheric noise;</p></li><li><p>radioactive decay;</p></li><li><p>turbulent motion; like that generated in Cloudflare’s wall of <a href="/lavarand-in-production-the-nitty-gritty-technical-details/">lava lamps(!)</a>.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2nJtxum8JhhrkxOyplTTka/e96eaea45650c205a68cda95c4ee9b8a/pasted-image-0--1-.png" />
            
            </figure><p>Unfortunately, these phenomena require very specific measuring tools, which are prohibitively expensive to install in mainstream consumer electronics. As such, most personal computing devices usually use external usage characteristics for seeding specific generator functions that output randomness as and when the system requires it. These characteristics include keyboard typing patterns and speed and mouse movement – since such usage patterns are based on the human user, it is assumed they provide sufficient entropy as a randomness source. An example of a random number generator that takes entropy from these characteristics is the Linux-based <a href="https://en.wikipedia.org/wiki/RdRand">RDRAND</a> function.</p><p>Naturally, it is difficult to tell whether a system is <i>actually</i> returning random outputs by only inspecting the outputs. There are statistical tests that detect whether a series of outputs is not uniformly distributed, but these tests cannot ensure that they are unpredictable. This means that it is hard to detect if a given system has had its randomness generation compromised.</p>
    <div>
      <h2>Distributed randomness</h2>
      <a href="#distributed-randomness">
        
      </a>
    </div>
    <p>It’s clear we need alternative methods for sampling randomness so that we can provide guarantees that trusted mechanisms, such as elections and lotteries, take place in secure tamper-resistant environments. The <a href="https://github.com/dedis/drand/">drand</a> project was started by researchers at <a href="https://www.epfl.ch/about/">EPFL</a> to address this problem. The drand charter is to provide an easily configurable randomness beacon running at geographically distributed locations around the world. The intention is for each of these beacons to generate portions of randomness that can be combined into a single random string that is publicly verifiable.</p><p>This functionality is achieved using <i>threshold cryptography</i>. Threshold cryptography seeks to derive solutions for standard cryptographic problems by combining information from multiple distributed entities. The notion of the threshold means that if there are <code>n</code> entities, then any <code>t</code> of the entities can combine to construct some cryptographic object (like a ciphertext, or a digital signature). These threshold systems are characterised by a setup phase, where each entity learns a <i>share</i> of data. They will later use this share of data to create a combined cryptographic object with a subset of the other entities.</p>
    <div>
      <h3>Threshold randomness</h3>
      <a href="#threshold-randomness">
        
      </a>
    </div>
    <p>In the case of a distributed randomness protocol, there are <code>n</code> <i>randomness beacons</i> that broadcast random values sampled from their initial data share, and the current state of the system. This data share is created during a trusted setup phase, and also takes in some internal random value that is generated by the beacon itself.</p><p>When a user needs randomness, they send requests to some number <code>t</code> of beacons, where <code>t &lt; n</code>, and combine these values using a specific procedure. The result is a random value that can be verified and used for public auditing mechanisms.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7BeauvWICHvAH9uX1tCqaY/47a57124c026459500347cf14757f818/pasted-image-0--2-.png" />
            
            </figure><p>Consider what happens if some proportion <code>c/n</code> of the randomness beacons are <i>corrupted</i> at any one time. The nature of a threshold cryptographic system is that, as long as <code>c &lt; t</code>, then the end result still remains random.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5NM7oB6KqjsC5ys55cVEGP/9165d5ad0c235240b6e455cf08e62f1e/pasted-image-0--3-.png" />
            
            </figure><p>If <code>c</code> exceeds <code>t</code> then the random values produced by the system become predictable and the notion of randomness is lost. In summary, the distributed randomness procedure provides verifiably random outputs with sufficient entropy only when <code>c &lt; t</code>.</p><p>By distributing the beacons independent of each other and in geographically disparate locations, the probability that <code>t</code> locations can be corrupted at any one time is extremely low. The minimum choice of <code>t</code> is equal to <code>n/2</code>.</p>
    <div>
      <h2>How does it actually work?</h2>
      <a href="#how-does-it-actually-work">
        
      </a>
    </div>
    <p>What we described above sounds a bit like magic<sup>tm</sup>. Even if <code>c = t-1</code>, then we can ensure that the output is indeed random and unpredictable! To make it clearer how this works, let’s dive a bit deeper into the underlying cryptography.</p><p>Two core components of drand are: a <i>distributed key generation</i> (DKG) procedure, and a <i>threshold signature scheme</i>. These core components are used in setup and randomness generation procedures, respectively. In just a bit, we’ll outline how drand uses these components (without navigating too deeply into the onerous mathematics).</p>
    <div>
      <h3>Distributed key generation</h3>
      <a href="#distributed-key-generation">
        
      </a>
    </div>
    <p>At a high-level, the DKG procedure creates a distributed secret key that is formed of <code>n</code> different key pairs <code>(vk_i, sk_i)</code>, each one being held by the entity <code>i</code> in the system. These key pairs will eventually be used to instantiate a <code>(t,n)</code>-threshold signature scheme (we will discuss this more later). In essence, <code>t</code> of the entities will be able to combine to construct a valid signature on any message.</p><p>To think about how this might work, consider a distributed key generation scheme that creates <code>n</code> distributed keys that are going to be represented by pizzas. Each pizza is split into <code>n</code> slices and one slice from each is secretly passed to one of the participants. Each entity receives one slice from each of the different pizzas (<code>n</code> in total) and combines these slices to form their own pizza. Each combined pizza is unique and secret for each entity, representing their own key pair.</p>
    <div>
      <h4>Mathematical intuition</h4>
      <a href="#mathematical-intuition">
        
      </a>
    </div>
    <p>Mathematically speaking, and rather than thinking about pizzas, we can describe the underlying phenomenon by reconstructing lines or curves on a graph. We can take two coordinates on a <code>(x,y)</code> plane and immediately (and uniquely) define a line with the equation <code>y = ax+b</code>. For example, the points <code>(2,3)</code> and <code>(4,7)</code> immediately define a line with gradient <code>(7-3)/(4/2) = 2</code> so <code>a=2</code>. You can then derive the <code>b</code> coefficient as <code>-1</code> by evaluating either of the coordinates in the equation <code>y = 2x + b</code>. By <i>uniquely</i>, we mean that only the line <code>y = 2x -1</code> satisfies the two coordinates that are chosen; no other choice of <code>a</code> or <code>b</code> fits.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2htl50xQeT4euGS3VR6rxf/de0f4b27b223bd88f4fc90ebd204367e/line2-2-.png" />
            
            </figure><p>The curve <code>ax+b</code> has degree <code>1</code>, where the degree of the equation refers to the highest order multiplication of unknown variables in the equation. That might seem like mathematical jargon, but the equation above contains only one term <code>ax</code>, which depends on the unknown variable <code>x</code>. In this specific term, the  <i>exponent</i> (or <i>power</i>) of <code>x</code> is <code>1</code>, and so the degree of the entire equation is also <code>1</code>.</p><p>Likewise, by taking three sets of coordinates pairs in the same plane, we uniquely define a quadratic curve with an equation that approximately takes the form <code>y = ax^2 + bx + c</code> with the coefficients <code>a,b,c</code> uniquely defined by the chosen coordinates. The process is a bit more involved than the above case, but it essentially starts in the same way using three coordinate pairs <code>(x_1, y_1)</code>, <code>(x_2, y_2)</code> and <code>(x_3, y_3)</code>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/24FGvRaMCx5lUA2umjk6wi/4e76792bba003072606d6196c0febdc2/line3.png" />
            
            </figure><p>By a quadratic curve, we mean a curve of degree <code>2</code>. We can see that this curve has degree <code>2</code> because it contains two terms <code>ax^2</code> and <code>bx</code> that depend on <code>x</code>. The highest order term is the <code>ax^2</code> term with an exponent of <code>2</code>, so this curve has degree <code>2</code> (ignore the term <code>bx</code> which has a smaller power).</p><p>What we are ultimately trying to show is that this approach scales for curves of degree <code>n</code> (of the form <code>y = a_n x^n + … a_1 x + a_0</code>). So, if we take <code>n+1</code> coordinates on the <code>(x,y)</code> plane, then we can uniquely reconstruct the curve of this form entirely. Such degree <code>n</code> equations are also known as <i>polynomials</i> of degree <code>n</code>.</p><p>In order to generalise the approach to general degrees we need some kind of formula. This formula should take <code>n+1</code> pairs of coordinates and return a polynomial of degree <code>n</code>. Fortunately, such a formula exists without us having to derive it ourselves, it is known as the <a href="https://en.wikipedia.org/wiki/Lagrange_polynomial#Definition"><i>Lagrange interpolation polynomial</i></a>. Using the formula in the link, we can reconstruct any <code>n</code> degree polynomial using <code>n+1</code> unique pairs of coordinates.</p><p>Going back to pizzas temporarily, it will become clear in the next section how this Lagrange interpolation procedure essentially describes the dissemination of one slice (corresponding to <code>(x,y)</code> coordinates) taken from a single pizza (the entire <code>n-1</code> degree polynomial) among <code>n</code> participants. Running this procedure <code>n</code> times in parallel allows each entity to construct their entire pizza (or the eventual key pair).</p>
    <div>
      <h4>Back to key generation</h4>
      <a href="#back-to-key-generation">
        
      </a>
    </div>
    <p>Intuitively, in the DKG procedure we want to distribute <code>n</code> key pairs among <code>n</code> participants. This effectively means running <code>n</code> parallel instances of a <code>t</code>-out-of-<code>n</code> <a href="https://en.wikipedia.org/wiki/Shamir's_Secret_Sharing">Shamir Secret Sharing</a> scheme. This secret sharing scheme is built entirely upon the polynomial interpolation technique that we described above.</p><p>In a single instance, we take the secret key to be the first coefficient of a polynomial of degree <code>t-1</code> and the public key is a published value that depends on this secret key, but does not reveal the actual coefficient. Think of RSA, where we have a number <code>N = pq</code> for secret large prime numbers <code>p,q</code>, where <code>N</code> is public but does not reveal the actual factorisation. Notice that if the polynomial is reconstructed using the interpolation technique above, then we immediately learn the secret key, because the first coefficient will be made explicit.</p><p>Each secret sharing scheme publishes shares, where each share is a different evaluation of the polynomial (dependent on the entity <code>i</code> receiving the key share). These evaluations are essentially coordinates on the <code>(x,y)</code> plane.</p><p>By running <code>n</code> parallel instances of the secret sharing scheme, each entity receives <code>n</code> shares and then combines all of these to form their overall key pair <code>(vk_i, sk_i)</code>.</p><p>The DKG procedure uses <code>n</code> parallel secret sharing procedures along with <a href="https://link.springer.com/chapter/10.1007/3-540-46766-1_9">Pedersen commitments</a> to distribute the key pairs. We explain in the next section how this procedure is part of the procedure for provisioning randomness beacons.</p><p>In summary, it is important to remember that <b>each party</b> in the DKG protocol generates a random secret key from the <code>n</code> shares that they receive, and they compute the corresponding public key from this. We will now explain how each entity uses this key pair to perform the cryptographic procedure that is used by the drand protocol.</p>
    <div>
      <h3>Threshold signature scheme</h3>
      <a href="#threshold-signature-scheme">
        
      </a>
    </div>
    <p>Remember: a standard signature scheme considers a key-pair <code>(vk,sk)</code>, where <code>vk</code> is a public verification key and <code>sk</code> is a private signing key. So, messages <code>m</code> signed with <code>sk</code> can be verified with <code>vk</code>. The security of the scheme ensures that it is difficult for anybody who does not hold <code>sk</code> to compute a valid signature for any message <code>m</code>.</p><p>A <i>threshold signature scheme</i> allows a set of users holding distributed key-pairs <code>(vk_i,sk_i)</code> to compute intermediate signatures <code>u_i</code> on a given message <code>m</code>.</p><p>Given knowledge of some number <code>t</code> of intermediate signatures <code>u_i</code>, a valid signature <code>u</code> on the message <code>m</code> can be reconstructed under the combined secret key <code>sk</code>. The public key <code>vk</code> can also be inferred using knowledge of the public keys <code>vk_i</code>, and then this public key can be used to verify <code>u</code>.</p><p>Again, think back to reconstructing the degree <code>t-1</code> curves on graphs with <code>t</code> known coordinates. In this case, the coordinates correspond to the intermediate signatures <code>u_i</code>, and the signature <code>u</code> corresponds to the entire curve. For the actual signature schemes, the mathematics are much more involved than in the DKG procedure, but the principal is the same.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2SpuFg5fE6Trs3KhVfGeQq/829504847821500097e2b7474a83037d/threshold-sig-3-.png" />
            
            </figure>
    <div>
      <h3>drand protocol</h3>
      <a href="#drand-protocol">
        
      </a>
    </div>
    <p>The <code>n</code> beacons that will take part in the drand project are identified. In the trusted setup phase, the DKG protocol from above is run, and each beacon effectively creates a key pair <code>(vk_i, sk_i)</code> for a threshold signature scheme. In other words, this key pair will be able to generate intermediate signatures that can be combined to create an entire signature for the system.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4ZkOUnhX8QiVnhPou3nC9/c7657ac1ec50d7156fee239f69e57e28/DKG-6-.png" />
            
            </figure><p>For each round (occurring once a minute, for example), the beacons agree on a signature <code>u</code> evaluated over a message containing the previous round’s signature and the current round’s number. This signature <code>u</code> is the result of combining the intermediate signatures <code>u_i</code> over the same message. Each intermediate signature <code>u_i</code> is created by each of the beacons using their secret <code>sk_i</code>.</p><p>Once this aggregation completes, each beacon displays the signature for the current round, along with the previous signature and round number. This allows any client to publicly verify the signature over this data to verify that the beacons honestly aggregate. This provides a chain of verifiable signatures, extending back to the first round of output. In addition, there are threshold signature schemes that output signatures that are indistinguishable from random sequences of bytes. Therefore, these signatures can be used directly as verifiable randomness for the applications we discussed previously.</p>
    <div>
      <h3>What does drand use?</h3>
      <a href="#what-does-drand-use">
        
      </a>
    </div>
    <p>To instantiate the required threshold signature scheme, drand uses the <code>(t,n)</code>-<a href="https://www.iacr.org/archive/pkc2003/25670031/25670031.pdf">BLS signature scheme</a> of Boneh, Lynn and Shacham. In particular, we can instantiate this scheme in the elliptic curve setting using  <a href="https://github.com/dfinity/bn">Barreto-Naehrig</a> curves. Moreover, the BLS signature scheme outputs sufficiently large signatures that are randomly distributed, giving them enough entropy to be sources of randomness. Specifically the signatures are randomly distributed over 64 bytes.</p><p>BLS signatures use a specific form of mathematical operation known as a <i>cryptographic pairing</i>. Pairings can be computed in certain elliptic curves, including the Barreto-Naehrig curve configurations. A detailed description of pairing operations is beyond the scope of this blog post; though it is important to remember that these operations are integral to how BLS signatures work.</p><p>Concretely speaking, all drand cryptographic operations are carried out using a library built on top of Cloudflare's implementation of the <a href="https://github.com/cloudflare/bn256/tree/lattices">bn256 curve</a>. The Pedersen DKG protocol follows the design of <a href="https://link.springer.com/article/10.1007/s00145-006-0347-3">Gennaro et al.</a>.</p>
    <div>
      <h3>How does it work?</h3>
      <a href="#how-does-it-work">
        
      </a>
    </div>
    <p>The randomness beacons are synchronised in rounds. At each round, a beacon produces a new signature <code>u_i</code> using its private key <code>sk_i</code> on the previous signature generated and the round ID. These signatures are usually broadcast on the URL <code>drand.&lt;host&gt;.com/api/public</code>. These signatures can be verified using the keys <code>vk_i</code> and over the same data that is signed. By signing the previous signature and the current round identifier, this establishes a chain of trust for the randomness beacon that can be traced back to the original signature value.</p><p>The randomness can be retrieved by combining the signatures from each of the beacons using the threshold property of the scheme. This reconstruction of the signature <code>u</code> from each intermediate signature <code>u_i</code> is done internally by the League of Entropy nodes. Each beacon broadcasts the entire signature <code>u</code>, that can be accessed over the HTTP endpoint above.</p>
    <div>
      <h2>The drand beacon</h2>
      <a href="#the-drand-beacon">
        
      </a>
    </div>
    <p>As we mentioned at the start of this blog post, Cloudflare has launched our <a href="/league-of-entropy">distributed randomness beacon</a>. This beacon is part of a network of beacons from different institutions around the globe that form the <a href="https://leagueofentropy.com">League of  Entropy</a>.</p><p>The Cloudflare beacon uses <a href="/lavarand-in-production-the-nitty-gritty-technical-details/">LavaRand</a> as its internal source of randomness for the DKG. Other League of Entropy drand beacons have their own sources of randomness.</p>
    <div>
      <h3>Give me randomness!</h3>
      <a href="#give-me-randomness">
        
      </a>
    </div>
    <blockquote><p>The below API endpoints are obsolete. Please see <a href="https://drand.love">https://drand.love</a> for the most up-to-date documentation.</p></blockquote><p>The drand beacon allows you to retrieve the latest random value from the League of Entropy using a simple HTTP request:</p>
            <pre><code>curl https://drand.cloudflare.com/api/public</code></pre>
            <p>The response is a JSON blob of the form:</p>
            <pre><code>{
    "round": 7,
    "previous": &lt;hex-encoded-previous-signature&gt;,
    "randomness": {
        "gid": 21,
        "point": &lt;hex-encoded-new-signature&gt;
    }
}</code></pre>
            <p>where, <code>randomness.point</code> is the signature <code>u</code> aggregated among the entire set of beacons.</p><p>The signature is computed as an evaluation of the message, and is comprised of the signature of the previous round, <code>previous</code>, the current round number, <code>round</code>, and the aggregated secret key of the system. This signature can be verified using the entire public key <code>vk</code> of the Cloudflare beacon, learned using another HTTP request:</p>
            <pre><code>curl https://drand.cloudflare.com/api/public</code></pre>
            <p>There are eight collaborators in the League of Entropy. You can learn the current round of randomness (or the system’s public key) by querying these beacons on the HTTP endpoints listed above.</p><ul><li><p><a href="https://drand.cloudflare.com:443">https://drand.cloudflare.com:443</a></p></li><li><p><a href="https://random.uchile.cl:8080">https://random.uchile.cl:8080</a></p></li><li><p><a href="https://drand.cothority.net:7003">https://drand.cothority.net:7003</a></p></li><li><p><a href="https://drand.kudelskisecurity.com:443">https://drand.kudelskisecurity.com:443</a></p></li><li><p><a href="https://drand.lbarman.ch:443">https://drand.lbarman.ch:443</a></p></li><li><p><a href="https://drand.nikkolasg.xyz:8888">https://drand.nikkolasg.xyz:8888</a></p></li><li><p><a href="https://drand.protocol.ai:8080">https://drand.protocol.ai:8080</a></p></li><li><p><a href="https://drand.zerobyte.io:8888">https://drand.zerobyte.io:8888</a></p></li></ul>
    <div>
      <h2>Randomness &amp; the future</h2>
      <a href="#randomness-the-future">
        
      </a>
    </div>
    <p>Cloudflare will continue to take an active role in the drand project, both as a contributor and by running a randomness beacon with the League of Entropy. The League of Entropy is a worldwide joint effort of individuals and academic institutions. We at Cloudflare believe it can help us realize the mission of helping Build a Better Internet. For more information on Cloudflare's participation in the League of Entropy, visit <a href="https://leagueofentropy.com">https://leagueofentropy.com</a> or read <a href="/league-of-entropy">Dina's blog post</a>.</p><p>Cloudflare would like to thank all of their collaborators in the League of Entropy; from EPFL, UChile, Kudelski Security and Protocol Labs. This work would not have been possible without the work of those who contributed to the <a href="https://github.com/dedis/drand">open-source drand project</a>. We would also like to thank and appreciate the work of Gabbi Fisher, Brendan McMillion, and Mahrud Sayrafi in launching the Cloudflare randomness beacon.</p> ]]></content:encoded>
            <category><![CDATA[Crypto Week]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Programming]]></category>
            <guid isPermaLink="false">6yDv8PkyP9X3dUvYYh3MHZ</guid>
            <dc:creator>Alex Davidson</dc:creator>
        </item>
        <item>
            <title><![CDATA[LavaRand in Production: The Nitty-Gritty Technical Details]]></title>
            <link>https://blog.cloudflare.com/lavarand-in-production-the-nitty-gritty-technical-details/</link>
            <pubDate>Mon, 06 Nov 2017 06:07:00 GMT</pubDate>
            <description><![CDATA[ As some of you may know, there's a wall of lava lamps in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works in technical detail.  ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3GpGyNbUwxO7rvWhWGw0St/0fbdcd80d0a93d7bbee4966b7f2a2f66/lava-lamps.jpg" />
            
            </figure><p>Lava lamps in the Cloudflare lobby. Courtesy of <a href="https://twitter.com/mahtin/status/888251632550424577">@mahtin</a></p>
    <div>
      <h2>Introduction</h2>
      <a href="#introduction">
        
      </a>
    </div>
    <p>As some of you may know, <a href="https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps">there's a wall of lava lamps</a> in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works in technical detail. This post assumes a technical background. For a higher-level discussion that requires no technical background, see <a href="/randomness-101-lavarand-in-production">Randomness 101: LavaRand in Production</a>.</p>
    <div>
      <h2>Background</h2>
      <a href="#background">
        
      </a>
    </div>
    <p>As we’ve <a href="/why-randomness-matters/">discussed in the past</a>, cryptography relies on the ability to generate random numbers that are both unpredictable and kept secret from any adversary. In this post, we’re going to go into fairly deep technical detail, so there is some background that we’ll need to ensure that everybody is on the same page.</p>
    <div>
      <h3>True Randomness vs Pseudorandomness</h3>
      <a href="#true-randomness-vs-pseudorandomness">
        
      </a>
    </div>
    <p>In cryptography, the term <i>random</i> means <i>unpredictable</i>. That is, a process for generating random bits is secure if an attacker is unable to predict the next bit with greater than 50% accuracy (in other words, no better than random chance).</p><p>We can obtain randomness that is unpredictable using one of two approaches. The first produces <i>true randomness</i>, while the second produces <i>pseudorandomness</i>.</p><p>True randomness is any information learned through the measurement of a physical process. Its unpredictability relies either on the inherent unpredictability of the physical process being measured (e.g., the unpredictability of radioactive decay), or on the inaccuracy inherent in taking precise physical measurements (e.g., the inaccuracy of the least significant digits of some physical measurement such as the measurement of a CPU’s temperature or the timing of keystrokes on a keyboard). Random values obtained in this manner are unpredictable even to the person measuring them (the person performing the measurement can’t predict what the value will be before they have performed the measurement), and thus are just as unpredictable to an external attacker. All randomness used in cryptographic algorithms begins life as true randomness obtained through physical measurements.</p><p>However, obtaining true random values is usually expensive and slow, so using them directly in cryptographic algorithms is impractical. Instead, we use pseudorandomness. Pseudorandomness is generated through the use of a deterministic algorithm that takes as input some other random value called a <i>seed</i> and produces a larger amount of random output (these algorithms are called <i>cryptographically secure pseudorandom number generators</i>, or CSPRNGs). A CSPRNG has two key properties: First, if an attacker is unable to predict the value of the seed, then that attacker will be similarly unable to predict the output of the CSPRNG (and even if the attacker is shown the output up to a certain point - say the first 10 bits - the rest of the output - bits 11, 12, etc - will still be completely unpredictable). Second, since the algorithm is deterministic, running the algorithm twice with the same seed as input will produce identical output.</p><p>The CSPRNGs used in modern cryptography are both very fast and also capable of securely producing an effectively infinite amount of output<sup>1</sup> given a relatively small seed (on the order of a few hundred bits). Thus, in order to efficiently generate a lot of secure randomness, true randomness is obtained from some physical process (this is slow), and fed into a CSPRNG which in turn produces as much randomness as is required by the application (this is fast). In this way, randomness can be obtained which is both secure (since it comes from a truly random source that cannot be predicted by an attacker) and cheap (since a CSPRNG is used to turn the truly random seed into a much larger stream of pseudorandom output).</p>
    <div>
      <h3>Running Out of Randomness</h3>
      <a href="#running-out-of-randomness">
        
      </a>
    </div>
    <p>A common misconception is that a CSPRNG, if used for long enough, can “run out” of randomness. This is an understandable belief since, as we’ll discuss in the next section, operating systems often re-seed their CSPRNGs with new randomness to hedge against attackers discovering internal state, broken CSPRNGs, and other maladies.</p><p>But if an algorithm is a true CSPRNG in the <a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Definitions">technical sense</a>, then the only way for it to run out of randomness is for somebody to consume far more values from it than could ever be consumed in practice (think consuming values from a CSPRNG as fast as possible for thousands of years or more).<sup>2</sup></p><p>However, none of the fast CSPRNGs that we use in practice are proven to be true CSPRNGs. They’re just <i>strongly believed</i> to be true CSPRNGs, or something close to it. They’ve withstood the test of academic analysis, years of being used in production, attacks by resourced adversaries, and so on. But that doesn’t mean that they are without flaws. For example, SHA-1, long considered to be a cryptographically-secure collision-resistant hash function (a building block that can be used to construct a CSPRNG) was eventually discovered to be insecure. Today, it can be broken for $110,000’s worth of cloud computing resources.<sup>3</sup></p><p>Thus, even though we aren’t concerned with running out of randomness in a true CSPRNG, we also aren’t sure that what we’re using in practice are true CSPRNGs. As a result, to hedge against the possibility that an attacker has figured out how to break our CSPRNGs, designers of cryptographic systems often choose to re-seed CSPRNGs with fresh, newly-acquired true randomness just in case.</p>
    <div>
      <h3>Randomness in the Operating System</h3>
      <a href="#randomness-in-the-operating-system">
        
      </a>
    </div>
    <p>In most computer systems, one of the responsibilities of the operating system is to provide cryptographically-secure pseudorandomness for use in various security applications. Since the operating system cannot know ahead of time which applications will require pseudorandomness (or how much they will require), most systems simply keep an _entropy pool_<sup>4</sup> - a collection of randomness that is believed to be secure - that is used to seed a CSPRNG (e.g., <code>/dev/urandom</code> on Linux) which serves requests for randomness. The system then takes on the responsibility of not only seeding this entropy pool when the system first boots, but also of periodically updating the pool (and re-seeding the CSPRNG) with new randomness from whatever sources of true randomness are available to the system in order to hedge against broken CSPRNGs or attackers having compromised the entropy pool through other non-cryptographic attacks.</p><p>For brevity, and since Cloudflare’s production system’s run Linux, we will refer to the system’s pseudorandomness provider simply as <code>/dev/urandom</code>, although note that everything in this discussion is true of other operating systems as well.</p><p>Given this setup of an entropy pool and CSPRNG, there are a few situations that could compromise the security of <code>/dev/urandom</code>:</p><ul><li><p>The sources of true randomness used to seed theentropy pool could be too predictable, allowing an attacker to guess the values obtained from these sources, and thus to predict the output of <code>/dev/urandom</code>.</p></li><li><p>An attacker could have access to the sources of true randomness, thus being able to observe their values and thus predict the output of <code>/dev/urandom</code>.</p></li><li><p>An attacker could have the ability to modify the sources of true randomness, thus being able to influence the values obtained from these sources and thus predict the output of <code>/dev/urandom</code>.</p></li></ul>
    <div>
      <h3>Randomness Mixing</h3>
      <a href="#randomness-mixing">
        
      </a>
    </div>
    <p>A common approach to addressing these security issues is to mix multiple sources of randomness together in the system’s entropy pool, the idea being that so long as some of the sources remain uncompromised, the system remains secure. For example, if sources <i>X</i>, <i>Y</i>, and <i>Z</i>, when queried for random outputs, provide values <i>x</i>, <i>y</i>, and <i>z</i>, we might seed our entropy pool with <i>H(x, y, z)</i>, where <i>H</i> is a cryptographically-secure collision-resistant hash function. Even if we assume that two of these sources - say, <i>X</i> and <i>Y</i> - are malicious, so long as the attackers in control of them are not able to observe <i>Z</i>’s output,<sup>5</sup> then no matter what values of <i>x</i> and <i>y</i> they produce, <i>H(x, y, z)</i> will still be unpredictable to them.</p>
    <div>
      <h2>LavaRand</h2>
      <a href="#lavarand">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1thY8qByl6CmiTCI9tIgOG/5de49269d8aeae96359870cad09d3a16/lava-lamps-camera.jpg" />
            
            </figure><p>The view from the camera</p><p>While the probability is obviously very low that somebody will manage to predict or modify the output of the entropy sources on our production machines, it would be irresponsible of us to pretend that it is impossible. Similarly, while cryptographic attacks against state-of-the-art CSPRNGs are rare, they do occasionally happen. It’s important that we hedge against these possibilities by adding <a href="https://en.wikipedia.org/wiki/Defense_in_depth_(computing)">extra layers of defense</a>.</p><p>That’s where LavaRand comes in.</p><p>In short, LavaRand is a system that provides an additional entropy source to our production machines. In the lobby of our San Francisco office, we have a wall of lava lamps (pictured above). A video feed of this wall is used to generate entropy that is made available to our production fleet.</p><p>We're not the first ones to do this. Our LavaRand system was inspired by a similar system first <a href="https://en.wikipedia.org/wiki/Lavarand">proposed and built</a> by Silicon Graphics and <a href="https://www.google.com/patents/US5732138">patented</a> in 1996 (the patent has since expired).</p><p>The flow of the “lava” in a lava lamp is very unpredictable,6 and so the entropy in those lamps is incredibly high. Even if we conservatively assume that the camera has a resolution of 100x100 pixels (of course it’s actually much higher) and that an attacker can guess the value of any pixel of that image to within one bit of precision (e.g., they know that a particular pixel has a red value of either 123 or 124, but they aren’t sure which it is), then the total amount of entropy produced by the image is 100x100x3 = 30,000 bits (the x3 is because each pixel comprises three values - a red, a green, and a blue channel). This is orders of magnitude more entropy than we need.</p>
    <div>
      <h3>Design</h3>
      <a href="#design">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/HQnazwt1tj0ywVtjZ0HTX/4cbe7db55b4792b1b86dcea4a57b5474/Screen-Shot-2017-10-31-at-3.57.19-PM.png" />
            
            </figure><p>The flow of entropy in LavaRand</p><p>The overall design of the LavaRand system is pictured above. The flow of entropy can be broken down into the following steps:</p><p>The wall of lava lamps in the office lobby provides a source of true entropy.</p><p>In the lobby, a camera is pointed at the wall. It obtains entropy from both the visual input from the lava lamps and also from random noise in the individual photoreceptors.</p><p>In the office, there’s a server which connects to the camera. The server has its own entropy system, and the output of that entropy system is mixed with the entropy from the camera to produce a new entropy feed.</p><p>In one of our production data centers, there’s a service which connects to the server in the office and consumes its entropy feed. That service combines this entropy feed with output from its own local entropy system to produce yet another entropy feed. This feed is made available for any production service to consume.</p>
    <div>
      <h3>Security of the LavaRand Service</h3>
      <a href="#security-of-the-lavarand-service">
        
      </a>
    </div>
    <p>We might conceive of a number of attacks that could be leveraged against this system:</p><ul><li><p>An attacker could train a camera on the wall of lava lamps, attempting to reproduce the image captured by our camera.</p></li><li><p>An attacker could reduce the entropy from the wall of lava lamps by turning off the power to the lamps, shining a bright light at the camera, placing a lens cap on the camera, or any number of other physical attacks.</p></li><li><p>An attacker able to compromise the camera could exfiltrate or modify the feed of frames from the camera, replicating or controlling the entropy source used by the server in the office.</p></li><li><p>An attacker with code running on the office server could observe or modify the output of the entropy feed generated by that server.</p></li><li><p>An attacker with code running in the production service could observe or modify the output of the entropy feed generated by that service.</p></li></ul><p>Only one of these attacks would be fatal if successfully carried out: running code on the production service which produces the final entropy feed. In every other case, the malicious entropy feed controlled by the attacker is mixed with a non-malicious feed that the attacker can neither observe nor modify.<sup>7</sup> As we discussed in a previous section, as long as the attacker is unable to predict the output of these non-malicious feeds, they will be unable to predict the output of the entropy feed generated by mixing their malicious feed with the non-malicious feed.</p>
    <div>
      <h3>Using LavaRand</h3>
      <a href="#using-lavarand">
        
      </a>
    </div>
    <p>Having a secure entropy source is only half of the story - the other half is actually using it!</p><p>The goal of LavaRand is to ensure that our production machines have access to secure randomness <i>even if their local entropy sources are compromised</i>. Just after boot, each of our production machines contacts LavaRand over TLS to obtain a fixed-size chunk of fresh entropy called a “beacon.” It mixes this beacon into the entropy system (on Linux, by writing the beacon to <code>/dev/random</code>). After this point, in order to predict or control the output of <code>/dev/urandom</code>, an attacker would need to compromise both the machine’s local entropy sources <i>and</i> the LavaRand beacon.</p>
    <div>
      <h3>Bootstrapping TLS</h3>
      <a href="#bootstrapping-tls">
        
      </a>
    </div>
    <p>Unfortunately, the reality isn’t quite that simple. We’ve gotten ourselves into something of a chicken-and-egg problem here: we’re trying to hedge against bad entropy from our local entropy sources, so we have to assume those might be compromised. But TLS, like many cryptographic protocols, requires secure entropy in order to operate. And we require TLS to request a LavaRand beacon. So in order to ensure secure entropy, we have to have secure entropy…</p><p>We solve this problem by introducing a second special-purpose CSPRNG, and seeding it in a very particular way. Every machine in Cloudflare’s production fleet has its own permanent store of secrets that it uses just after boot to prove its identity to the rest of the fleet in order to bootstrap the rest of the boot process. We piggyback on that system by storing an extra random seed - unique for each machine - that we use for that first TLS connection to LavaRand.</p><p>There’s a simple but very useful result from cryptography theory that says that an HMAC - a hash-based message authentication code - when combined with a random, unpredictable seed, behaves (from the perspective of an attacker) like a random oracle. That’s a lot of crypto jargon, but it basically means that if you have a secret, randomly-generated seed, <i>s</i>, then an attacker will be completely unable to guess the output of <i>HMAC(s, x)</i> <i>regardless of the value of x</i> - even if <i>x</i> is completely predictable! Thus, you can use <i>HMAC(s, x)</i> as the seed to a CSPRNG, and the output of the CSPRNG will be unpredictable. Note, though, that if you need to do this multiple times, you will have to pick different values for <i>x</i>! Remember that while CSPRNGs are secure if used with unpredictable seeds, they’re also deterministic. Thus, if the same value is used for <i>x</i> more than once, then the CSPRNG will end up producing the same stream of “random” values more than once, which in cryptography is often very insecure!</p><p>This means that we can combine those unique, secret seeds that we store on each machine with an HMAC and produce a secure random value. We use the current time with nanosecond precision as the input to ensure that the same value is never used twice on the same machine. We use the resulting value to seed a CSPRNG, and we use that CSPRNG for the TLS connection to LavaRand. That way, even if the system’s entropy sources are compromised, we’ll still be able to make a secure connection to LavaRand, obtain a new, secure beacon, and bootstrap the system’s entropy back to a secure state!</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Hopefully we’ll never need LavaRand. Hopefully, the primary entropy sources used by our production machines will remain secure, and LavaRand will serve little purpose beyond adding some flair to our office. But if it turns out that we’re wrong, and that our randomness sources in production are actually flawed, then hopefully LavaRand will be our hedge, making it just a little bit harder to hack Cloudflare.</p><hr /><p><sup>1</sup> Some CSPRNGs exist with constraints on how much output can be consumed securely, but those are not the sort that we are concerned with in this post.</p><p><sup>2</sup> Section 3.1, <a href="https://www.usenix.org/system/files/conference/hotos15/hotos15-paper-corrigan-gibbs.pdf">Recommendations for Randomness in the Operating System</a></p><p><sup>3</sup> <a href="https://shattered.io/static/shattered.pdf">The first collision for full SHA-1</a></p><p><sup>4</sup> “Entropy” and “randomness” are synonyms in cryptography - the former is the more technical term.</p><p><sup>5</sup> If the attacker controls <i>X</i> and <i>Y</i> and can also observe the output of <i>Z</i>, then the attacker can still partially influence the output of <i>H(x, y, z)</i>. See <a href="http://blog.cr.yp.to/20140205-entropy.html">here</a> for a discussion of possible attacks.</p><p><sup>6</sup> Noll, L.C. and Mende, R.G. and Sisodiya, S., <a href="https://www.google.com/patents/US5732138"><i>Method for seeding a pseudo-random number generator with a cryptographic hash of a digitization of a chaotic system</i></a></p><p><sup>7</sup> A surprising example of the effectiveness of entropy is the mixing of the image captured by the camera with the random noise in the camera’s photoreceptors. If we assume that every pixel captured is either recorded as the “true” value or is instead recorded as one value higher than the true value (50% probability for each), then even if the input image can be reproduced by an attacker with perfect accuracy, the camera <i>still</i> provides one bit of entropy for each pixel channel. As discussed before, even for a 100x100 pixel camera, that’s 30,000 bits!</p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">6i8GxcLswvLnL74LrqK2Ef</guid>
            <dc:creator>Joshua Liebow-Feeser</dc:creator>
        </item>
        <item>
            <title><![CDATA[Randomness 101: LavaRand in Production]]></title>
            <link>https://blog.cloudflare.com/randomness-101-lavarand-in-production/</link>
            <pubDate>Mon, 06 Nov 2017 05:54:46 GMT</pubDate>
            <description><![CDATA[ As some of you may know, there's a wall of lava lamps in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works.  ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Lava lamps in the Cloudflare lobby Courtesy of <a href="https://twitter.com/mahtin/status/888251632550424577">@mahtin</a></p>
    <div>
      <h3>Introduction</h3>
      <a href="#introduction">
        
      </a>
    </div>
    <p>As some of you may know, <a href="https://www.fastcodesign.com/90137157/the-hardest-working-office-design-in-america-encrypts-your-data-with-lava-lamps">there's a wall of lava lamps</a> in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works. This post assumes no technical background. For a more in-depth look at the technical details, see <a href="/lavarand-in-production-the-nitty-gritty-technical-details">LavaRand in Production: The Nitty-Gritty Technical Details</a>.</p>
    <div>
      <h3>Background</h3>
      <a href="#background">
        
      </a>
    </div>
    
    <div>
      <h4>Randomness in Cryptography</h4>
      <a href="#randomness-in-cryptography">
        
      </a>
    </div>
    <p>As we’ve <a href="/why-randomness-matters/">discussed in the past</a>, cryptography relies on the ability to generate random numbers that are both unpredictable and kept secret from any adversary.</p><p>But “random” is a pretty tricky term; it’s used in many different fields to mean slightly different things. And like all of those fields, its use in cryptography is very precise. In some fields, a process is random simply if it has the right statistical properties. For example, the digits of pi are said to be random because all sequences of numbers appear with equal frequency (“15” appears as frequently as “38”, “426” appears as frequently as “297”, etc). But for cryptography, this isn’t enough - random numbers must be <i>unpredictable</i>.</p><p>To understand what <i>unpredictable</i> means, it helps to consider that all cryptography is based on an asymmetry of information. If you’re trying to securely perform some cryptographic operation, then what you’re concerned about is that somebody - an <i>adversary</i> - will try to break your security. The only thing that distinguishes you from the adversary is that you know some things that the adversary does not, and the job of cryptography is to ensure that this asymmetry of information is enough to keep you secure.</p><p>Let’s consider a simple example. Imagine that you and a friend are trying to go to a movie, but you don’t want your nemesis to figure out which movie you’re going to go to (lest she show up and thwart your movie watching!). This week, it’s your turn to choose the movie. Once you’ve made your choice, you’re going to need to send a message to your friend telling him which movie you’ve chosen, but you’re going to need to ensure that even if your nemesis intercepts the message, she won’t be able to figure out what it says.</p><p>You devise the following scheme: since there are only two movies available to watch at the moment, you label one A and the other B. Then, while in the presence of your friend, you flip a coin. You agree on the following table outlining which message that you will send depending on your choice of what movie to watch and whether the coin comes up heads (H) or tails (T). Later, once you’ve made up your mind about which movie to see, you’ll use this table to send an encrypted message to your friend telling him which movie you’ve chosen.</p><table><tr><td><p><b>Movie</b></p></td><td><p><b>Coin</b></p></td><td><p><b>Message</b></p></td></tr><tr><td><p>A</p></td><td><p>H</p></td><td><p>“The rain in Spain stays mainly on the plain.”</p></td></tr><tr><td><p>A</p></td><td><p>T</p></td><td><p>“In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.”</p></td></tr><tr><td><p>B</p></td><td><p>H</p></td><td><p>“In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.”</p></td></tr><tr><td><p>B</p></td><td><p>T</p></td><td><p>“The rain in Spain stays mainly on the plain.”</p></td></tr></table><p>If you were to decide on movie B, and the coin came up heads, you would send the message, “In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen.” Since your friend knows that the coin came up heads - he was there when it happened - he knows that you must have decided on movie B. But consider it from your nemesis’ perspective. She doesn’t know the result of the coin toss - all she knows is that there’s a 50% chance that the coin came up heads, and a 50% chance that it came up tails. Thus, seeing the message “In Hertford, Hereford, and Hampshire, hurricanes hardly ever happen” doesn’t help her at all! There’s a 50% chance that the coin came up heads (implying movie B), and a 50% chance that it came up tails (implying movie A). She doesn’t know anything more than she knew before!</p><p>Let’s return now to the concept of <i>unpredictability</i>. Imagine that the result of the coin toss was completely predictable - say your nemesis planted a trick coin that always comes up heads on the first toss, tails on the second, heads on the third, and so on. Since she would know that there was a 100% chance of the first coin toss coming up heads, then regardless of which message you sent, she would know which movie you were going to see. While the trick coin still exhibits some basic properties of “randomness” as the term is used in the field of statistics - it comes up heads as often as it comes up tails - it’s <i>predictable</i>, which makes it useless for cryptography. The takeaway: when we say <i>random</i> in the context of cryptography, we mean <i>unpredictable</i>.</p>
    <div>
      <h3>Randomness in Computing</h3>
      <a href="#randomness-in-computing">
        
      </a>
    </div>
    <p>Unfortunately for cryptographers, if there’s one thing computers are good at, it’s being predictable. They can execute the same code a million times, and so long as they are given the same inputs each time, they’ll always come up with the same outputs. This is very good for reliability, but it’s tricky when it comes to cryptography - after all, we <i>need</i> unpredictability!</p><p>The solution to this problem is <i>cryptographically-secure pseudorandom number generators</i> (CSPRNGs). CSPRNGs are algorithms which, provided an input which is itself unpredictable, produce a much larger stream of output which is also unpredictable. This stream can be extended indefinitely, producing as much output as required at any time in the future. In other words, if you were to flip a coin a number of times (a process which is known to be unpredictable) and then use the output of those coin flips as the input to a CSPRNG, an adversary who wasn’t able to predict the output of those coin flips would also be unable to predict the output of the CSPRNG - no matter how much output was consumed from the CSPRNG.</p><p>But even though CSPRNGs are a very powerful tool, they’re only one half of the equation - they still need an unpredictable input to operate. But as we said, computers aren’t unpredictable, so aren’t we back at square one? Well, not quite. It turns out that computers do usually have sources of unpredictability that they can use, but they’re pretty slow. What we can do is combine that slow process of gathering unpredictable input with a CSPRNG, which can take that input and produce a much larger amount of input more quickly, and we can satisfy all of our randomness needs!</p><p>But where can a computer get such unpredictable input, even slowly? The answer is <i>the real world</i>. While computers provide a nice simplification of the world for programmers to live in, real, physical computers still exist in the real, physical world. And that world is unpredictable. Computers have all sorts of ways of taking input from the real world - temperature sensors, keyboards, network interfaces, etc. All of these provide the ability to take measurements of the real world, and all of those measurements have some degree of inherent inaccuracy. As we’ll explain in a moment, that inaccuracy is the same thing as unpredictability, and this can be used! Common sources of unpredictable randomness include measuring the temperature of the CPU with high - and thus inaccurate - precision, measuring the timing of keystrokes on the keyboard with high precision, etc. To see how this can be used to produce unpredictable randomness, consider the question, “what’s the temperature of the room I’m sitting in right now?” You can probably estimate to within a couple of degrees - say, somewhere between 70 and 75 degrees Fahrenheit. But you probably have no idea what the temperature is to 2 decimal places of accuracy - is it 73.42 degrees or 73.47 degrees? By measuring the temperature with high precision and then using only the low-order digits of the measured value, you can get highly unpredictable randomness just by observing the world around you. And so can computers.</p><p>So, to recap:</p><ul><li><p>Randomness used in cryptography needs to be unpredictable.</p></li><li><p>Computers can slowly get a small amount of unpredictable randomness by measuring their environment.</p></li><li><p>Computers can greatly extend this randomness by using a CSPRNG which can quickly turn it into a large amount of unpredictable randomness.</p></li></ul>
    <div>
      <h3>Hedging Your Bets</h3>
      <a href="#hedging-your-bets">
        
      </a>
    </div>
    <p>If there’s one thing cryptographers are wary about, it’s certainty. Cryptographic systems are routinely shown to be less secure than they were originally thought to be, and we’re constantly updating our understanding of what algorithms are safe to use in what scenarios.</p><p>So it shouldn’t be any surprise that cryptographers like to hedge their bets by using more security than they believe necessary in case it turns out that one of their assumptions was wrong. It’s sort of like the cryptographer’s version of the engineering practice of designing buildings to withstand far more weight or wind or heat than they think will arise in practice.</p><p>When it comes to randomness, this hedging often takes the form of <i>mixing</i>. Unpredictable random values have the neat property that if they’re mixed in the right way with more unpredictable random values, then the result is at least as unpredictable as either of the inputs. That means that if you mix a random value which is highly unpredictability with a random value which is somewhat predictable, the result will be a highly unpredictable value.</p><p>This mixing property is useful because it allows you to mix unpredictable random values from many sources, and if you later discover that one of those sources was less unpredictable than you’d originally thought, it’s still OK - the other sources come to the rescue.</p>
    <div>
      <h3>LavaRand</h3>
      <a href="#lavarand">
        
      </a>
    </div>
    <p>At Cloudflare, we have thousands of computers in data centers all around the world, and each one of these computers needs cryptographic randomness. Historically, they got that randomness using the default mechanism made available by the operating system that we run on them, Linux.</p><p>But being good cryptographers, we’re always trying to hedge our bets. We wanted a system to ensure that even if the default mechanism for acquiring randomness was flawed, we’d still be secure. That’s how we came up with LavaRand.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/Vz4N3zljIz1BLk9Zj8EFH/df36b17492525695fceb79198df56823/lava-lamps-camera.jpg" />
            
            </figure><p>The view from the camera</p><p>LavaRand is a system that uses lava lamps as a secondary source of randomness for our production servers. A wall of lava lamps in the lobby of our San Francisco office provides an unpredictable input to a camera aimed at the wall. A video feed from the camera is fed into a CSPRNG, and that CSPRNG provides a stream of random values that can be used as an extra source of randomness by our production servers. Since the flow of the “lava” in a lava lamp is very unpredictable,<sup>1</sup> “measuring” the lamps by taking footage of them is a good way to obtain unpredictable randomness. Computers store images as very large numbers, so we can use them as the input to a CSPRNG just like any other number.</p><p>We're not the first ones to do this. Our LavaRand system was inspired by a similar system first <a href="https://en.wikipedia.org/wiki/Lavarand">proposed and built</a> by Silicon Graphics and <a href="https://www.google.com/patents/US5732138">patented</a> in 1996 (the patent has since expired).</p><p>Hopefully we’ll never need it. Hopefully, the primary sources of randomness used by our production servers will remain secure, and LavaRand will serve little purpose beyond adding some flair to our office. But if it turns out that we’re wrong, and that our randomness sources in production are actually flawed, then LavaRand will be our hedge, making it just a little bit harder to hack Cloudflare.</p><ol><li><p>Noll, L.C. and Mende, R.G. and Sisodiya, S., <a href="https://www.google.com/patents/US5732138"><i>Method for seeding a pseudo-random number generator with a cryptographic hash of a digitization of a chaotic system</i></a></p></li></ol><p></p> ]]></content:encoded>
            <category><![CDATA[LavaRand]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">cMgBPjWlpt6XfFcsYQhhc</guid>
            <dc:creator>Joshua Liebow-Feeser</dc:creator>
        </item>
        <item>
            <title><![CDATA[Ensuring Randomness with Linux's Random Number Generator]]></title>
            <link>https://blog.cloudflare.com/ensuring-randomness-with-linuxs-random-number-generator/</link>
            <pubDate>Thu, 03 Oct 2013 05:00:00 GMT</pubDate>
            <description><![CDATA[ When building secure systems, having a source of random numbers is essential. Without them, most cryptographic systems break down and the privacy and authenticity of communications between two parties can be subverted. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Flickr/mark van de wouw</p><p>When building secure systems, having a source of random numbers is essential. Without them, most cryptographic systems break down and the privacy and authenticity of communications between two parties can be subverted. For example, if you’re reading this using a link to <a href="/">https://blog.cloudflare.com</a> then the SSL connection you are using will have required random numbers to ensure its security (they were used as part of the establishment of the secure connection).</p><p>We’ve covered <a href="/why-randomness-matters">why secure systems require random numbers</a> in a previous blog post, but getting random numbers from a computer is very hard. This blog post looks at Linux’s internal random number generator and how it overcomes the problem of generating random numbers on a machine that’s anything but random.</p><p>CloudFlare’s servers require a good source of random numbers for authentication and to assure <a href="/staying-on-top-of-tls-attacks">perfect forward secrecy</a> in SSL. But, internally, the computers we all use are deterministic machines that follow instructions and are required to do so in a predictable manner. Uncertainty and unpredictability are not built in: there is no easy way to tell a computer to go flip a coin or roll some dice. To get randomness in a computer it has to be looked for in the outside world.</p><p>Consumer computers and mobile devices have a number of sensors that provide unpredictable input. The timing of keystrokes and mouse movements of a user will have some degree of randomness if measured closely enough. Noise from microphones and cameras can also provide a lot of randomness. Mobile devices have even more sources including fluctuating wifi signals, motion sensors and GPS information.</p><p>Most of these sensors are not available on servers where random numbers are needed most. This is especially true for servers that run in virtualized environments that might not have access to a precise system clock. For CloudFlare’s servers, we currently rely on the random number generator built into the Linux operating system.</p><p>Linux is one of the most popular operating systems in the world. It serves as the operating system for everything from the web servers and data centers of many the largest sites in the world (Google, Facebook, Amazon, Apple, etc.), to desktop computers (Ubuntu, Chrome OS, etc.) to embedded devices (smart TVs, Android, etc.). CloudFlare’s software is built on the solid foundation of the Linux operating system kernel.</p><p>Linux itself provides a random number service so that any program has access to random numbers at any time. Luckily for us, Linux is open source software and we can learn how it works by reading the code. And verify that it provides a suitable source of random numbers for our cryptographic purposes.</p>
    <div>
      <h4>Entropy and Randomness</h4>
      <a href="#entropy-and-randomness">
        
      </a>
    </div>
    <p>Not all randomness is created equally. There are two sorts of randomness to think about: uniformity and unpredictability. A random number generator provides ‘uniform’ output if all numbers will come up equally often if run long enough. That’s useful for modeling random processes, but not good enough for security.</p><p>For computer security, random numbers need to be hard to guess: they need to be unpredictable. The predictability of numbers is quantified in a measure called entropy.</p><p>If a fair coin is tossed it provides one bit of entropy: the coin lands with equal probability on heads or tails (which can be thought of as 0 and 1). Because the probability is equal there’s no predictability in the coin’s ‘output’. We say it provides one bit of entropy.</p><p>An unfair coin toss provides less than one bit, since it’s much easier to guess when you know the bias. Flipping a coin with heads on both sides provides no entropy, since the result of a coin toss can be guessed with absolute certainty.</p><p>Entropy is distinct from statistical randomness. Looking at the statistical properties of a stream of numbers does not guarantee that the stream contains any entropy. For example, the digits of pi look random by almost any statistical measure, but contain no entropy since there is a well known formula to calculate them and perfectly predict the next value. (As an aside, pi is an example of a <a href="https://en.wikipedia.org/wiki/Normal_number">normal number</a>: one where all the digits will appear in equal quantities).</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5b7vLFi4E7629OD9FcOzR9/801744468dbdaf714d4fce985544f865/image02.jpg" />
            
            </figure><p>Flickr/foxtongue License: CC Attribution 2.0 Generic</p><p>Also, large numbers do not always have high entropy. You can take a small random number and turn it into a large random number and the entropy remains the same. For example, take a random number from 1 to 16 and compute its cryptographic hash with an algorithm like SHA-1. The resulting 160 bit number looks very random, but it is only one of only 16 possible such numbers. Guessing the number is just as easy as guessing a random number from 1 to 16. It’s the size of the pool from which random numbers are drawn that matters.</p><p>For cryptographic keys, the amount of entropy used to create them is tied to how hard they are to guess. A 128 bit key created from a source with 20 bits of entropy is no more secure than a 20 bit key. A good source of entropy is necessary to create secure keys.</p>
    <div>
      <h4>Take a dip in the pool</h4>
      <a href="#take-a-dip-in-the-pool">
        
      </a>
    </div>
    <p>On Linux, the root of all randomness is something called the kernel entropy pool. This is a large (4,096 bit) number kept privately in the kernel’s memory. There are 2<sup>4096</sup> possibilities for this number so it can contain up to 4,096 bits of entropy. There is one caveat - the kernel needs to be able to fill that memory from a source with 4,096 bits of entropy. And that’s the hard part: finding that much randomness.</p><p>The entropy pool is used in two ways: random numbers are generated from it and it is replenished with entropy by the kernel. When random numbers are generated from the pool the entropy of the pool is diminished (because the person receiving the random number has some information about the pool itself). So as the pool’s entropy diminishes as random numbers are handed out, the pool must be replenished.</p><p>Replenishing the pool is called stirring: new sources of entropy are stirred into the mix of bits in the pool.</p><p>This is the key to how random number generation works on Linux. If randomness is needed, it’s derived from the entropy pool. When available, other sources of randomness are used to stir the entropy pool and make it less predictable. The details are a little mathematical, but it’s interesting to understand how the Linux random number generator works as the principles and techniques apply to random number generation in other software and systems.</p><p>The kernel keeps a rough estimate of the number of bits of entropy in the pool. You can check the value of this estimate through the following command:</p><p>cat /proc/sys/kernel/random/entropy_avail</p><p>A healthy Linux system with a lot of entropy available will have return close to the full 4,096 bits of entropy. If the value returned is less than 200, the system is running low on entropy.</p>
    <div>
      <h4>The kernel is watching you</h4>
      <a href="#the-kernel-is-watching-you">
        
      </a>
    </div>
    <p>I mentioned that the system takes other sources of randomness and uses this to stir the entropy pool. This is achieved using something called a timestamp.</p><p>Most systems have precise internal clocks. Every time that a user interacts with a system, the value of the clock at that time is recorded as a timestamp. Even though the year, month, day and hour are generally guessable, the millisecond and microsecond are not and therefore the timestamp contains some entropy. Timestamps obtained from the user’s mouse and keyboard along with timing information from the network and disk each have different amount of entropy.</p><p>How does the entropy found in a timestamp get transferred to the entropy pool? Simple, use math to mix it in. Well, simple if you like math.</p>
    <div>
      <h4>Just mix it in</h4>
      <a href="#just-mix-it-in">
        
      </a>
    </div>
    <p>A fundamental property of entropy is that it mixes well. If you take two unrelated random streams and combine them, the new stream cannot have less entropy. Taking a number of low entropy sources and combining them results in a high entropy source.</p><p>All that’s needed is the right combination function: a function that can be used to combine two sources of entropy. One of the simplest such functions is the logical exclusive or (XOR). This truth table shows how bits x and y coming from different random streams are combined by the XOR function.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/21eHCWkYIi7WYIUkY08u1G/0ffb220acfc5ea40ca5729e0060e7cdf/image03.png" />
            
            </figure><p>Even if one source of bits does not have much entropy, there is no harm in XORing it into another source. Entropy always increases. In the Linux kernel, a combination of XORs is used to mix timestamps into the main entropy pool.</p>
    <div>
      <h4>Generating random numbers</h4>
      <a href="#generating-random-numbers">
        
      </a>
    </div>
    <p>Cryptographic applications require very high entropy. If a 128 bit key is generated with only 64 bits of entropy then it can be guessed in 2<sup>64</sup> attempts instead of 2<sup>128</sup> attempts. That is the difference between needing a thousand computers running for a few years to brute force the key versus needing all the computers ever created running for longer than the history of the universe to do so.</p><p>Cryptographic applications require close to one bit of entropy per bit. If the system’s pool has fewer than 4,096 bits of entropy, how does the system return a fully random number? One way to do this is to use a cryptographic hash function.</p><p>A cryptographic hash function takes an input of any size and outputs a fixed size number. Changing one bit of the input will change the output completely. Hash functions are good at mixing things together. This mixing property spreads the entropy from the input evenly through the output. If the input has more bits of entropy than the size of the output, the output will be highly random. This is how highly entropic random numbers are derived from the entropy pool.</p><p>The hash function used by the Linux kernel is the standard SHA-1 cryptographic hash. By hashing the entire pool and and some additional arithmetic, 160 random bits are created for use by the system. When this happens, the system lowers its estimate of the entropy in the pool accordingly.</p><p>Above I said that applying a hash like SHA-1 could be dangerous if there wasn’t enough entropy in the pool. That’s why it’s critical to keep an eye on the available system entropy: if it drops too low the output of the random number generator could have less entropy that it appears to have.</p>
    <div>
      <h4>Running out of entropy</h4>
      <a href="#running-out-of-entropy">
        
      </a>
    </div>
    <p>One of the dangers of a system is running out of entropy. When the system’s entropy estimate drops to around the 160 bit level, the length of a SHA-1 hash, things get tricky, and how they effect programs and performance depends on which of two Linux random number generators are used.</p><p>Linux exposes two interfaces for random data that behave differently when the entropy level is low. They are /dev/random and /dev/urandom. When the entropy pool becomes predictable, both interfaces for requesting random numbers become problematic.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5kINVbY4jlPxrSntHYa2wY/ae4cd21549842bcf6d57e9e1e480f8ff/image01.png" />
            
            </figure><p>When the entropy level is too low, /dev/random blocks and does not return until the level of entropy in the system is high enough. This guarantees high entropy random numbers. If /dev/random is used in a time-critical service and the system has not incorporated a minimum amount of entropy, the delays could be detrimental to the quality of service.</p><p>On the other hand, /dev/urandom does not block. It continues to return the hashed value of its entropy pool even though there is little to no entropy in it. This data is not necessarily low-entropy. As long as the entropy pool has incorporated enough entropy, it's likely not to be catastrophic to use. However, if the entropy pool has not been seeded, this data is not suited for cryptographic use.</p><p>The solution to the problem is to simply add more entropy into the system.</p>
    <div>
      <h4>Hardware random number generation to the rescue?</h4>
      <a href="#hardware-random-number-generation-to-the-rescue">
        
      </a>
    </div>
    <p>Intel’s Ivy Bridge family of processors have an interesting feature called “<a href="http://software.intel.com/en-us/blogs/2012/05/14/what-is-intelr-secure-key-technology">secure key</a>." These processors contain a special piece of hardware inside that generates random numbers. The single assembly instruction RDRAND returns allegedly high entropy random data derived on the chip.</p><p>It has been suggested that Intel’s hardware number generator <a href="http://www.afr.com/p/technology/intel_chips_could_be_nsa_key_to_ymrhS1HS1633gCWKt5tFtI">may not be fully random</a>. Since it is baked into the silicon, that assertion is hard to audit and verify. As it turns out, even if the numbers generated have some bias, it can still help as long as this is not the only source of randomness in the system. Even if the random number generator itself had a back door, the mixing property of randomness means that it cannot lower the amount of entropy in the pool.</p><p>On Linux, if a hardware random number generator is present, the Linux kernel will use the XOR function to mix the output of RDRAND into the hash of the entropy pool. This happens <a href="http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/char/random.c#n946">here in the Linux source code</a> (the XOR operator is ^ in C).</p>
    <div>
      <h4>Third party entropy generators</h4>
      <a href="#third-party-entropy-generators">
        
      </a>
    </div>
    <p>Hardware number generation is not available everywhere, and the sources of randomness polled by the Linux kernel itself are somewhat limited. For this situation, a number of third party random number generation tools exist. Examples of these are <a href="http://www.issihosts.com/haveged/">haveged</a>, which relies on processor cache timing, <a href="http://www.vanheusden.com/aed/">audio-entropyd</a> and <a href="http://www.vanheusden.com/ved/">video-entropyd</a> which work by sampling the noise from an external audio or video input device. By mixing these additional sources of locally collected entropy into the Linux entropy pool, the entropy can only go up.</p>
    <div>
      <h4>A diversity of sources</h4>
      <a href="#a-diversity-of-sources">
        
      </a>
    </div>
    <p>The main thing to understand is that better randomness comes through diversity. Taking a variety of sources of random data and mixing them together results in better random numbers. For servers, this should include data local to the machine (hardware random number generator, network timing) along with sources derived externally in a safe location. </p>
    <div>
      <h4>Looking ahead</h4>
      <a href="#looking-ahead">
        
      </a>
    </div>
    <p>In addition to the sources described above, there are many sources of random numbers to be harvested. These include lava lamps, space noise and the quantum properties of light. CloudFlare is working on a system to ensure high quality random numbers to all of our servers by adding new sources into the system Linux currently provides. As these systems come online over the coming months, we will share the details with the community.</p> ]]></content:encoded>
            <category><![CDATA[SSL]]></category>
            <category><![CDATA[Entropy]]></category>
            <category><![CDATA[Linux]]></category>
            <guid isPermaLink="false">1Bvlu2p4jPl40bm55iTEFe</guid>
            <dc:creator>Nick Sullivan</dc:creator>
        </item>
    </channel>
</rss>