<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="https://sandfox.me/assets/xml/atom.xsl" type="text/xsl media="all"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">
  <title>Sand Fox (Posts about arithmetic)</title>
  <id>https://sandfox.me/tags/arithmetic.xml</id>
  <updated>2026-09-02T00:44:41Z</updated>
  <author>
    <name>Anton Smirnov</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://sandfox.me/tags/arithmetic.xml"/>
  <link rel="alternate" type="text/html" href="https://sandfox.me/tags/arithmetic.html"/>
  <generator uri="https://getnikola.com/">Nikola</generator>
  <entry>
    <title>Unsigned</title>
    <id>https://sandfox.me/php/unsigned.html</id>
    <updated>2022-09-06T20:54:00+03:00</updated>
    <published>2022-09-06T20:54:00+03:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/php/unsigned.html"/>
    <summary type="html">&lt;p&gt;Unsigned is a fixed (but arbitrary) length unsigned integer arithmetic library for native PHP.
It was created as a helper for the &lt;a class="reference external" href="https://sandfox.me/php/random-polyfill.html"&gt;Random Extension Polyfill&lt;/a&gt; to remove hard dependency on the GMP.
It may be useful for weird arithmetic with shifts and unsigned overflows that is used in RNGS, encryptors, hashes, etc.
(But it won't be cryptographically secure! Time based attacks are quite possible because of some optimizations)
Performance greatly depends on the PHP version, with PHP 8.0+ it performs quite nicely, only slightly slower than GMP.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://sandfox.dev/php/unsigned.html"&gt;https://sandfox.dev/php/unsigned.html&lt;/a&gt;&lt;/p&gt;</summary>
    <category term="arithmetic" label="arithmetic"/>
    <category term="lib" label="lib"/>
  </entry>
</feed>
