Skip to content

v0.16.0

Compare
Choose a tag to compare
@github-actions github-actions released this 20 Sep 13:33
· 553 commits to main since this release

What's new?

Carry-less Multiplication

process of computing a carry-less multiplication (source: Wikipedia

We are introducing Carry-less multiplication into Keelung.

What is it?

Carry-less multiplication (also known as XOR multiplication) takes two UInt numbers and multiplies them by performing schoolbook long multiplication, except that all carries are discarded along the way.

What for?

Carry-less multiplication allows us to simulate multiplication of binary fields on prime fields. It's a critical component for implementing cryptographic primitives like the AES cipher.

Intel even has an instruction set called CLMUL with specialized hardware dedicated to accelerate this operation!

How to use it?

It is defined as an infix operator .*. on unsigned integers UInt.

(.*.) :: KnownNat w => UInt w -> UInt w -> UInt w

Simply drop them in between two UInt like you would with normal multiplication:

example :: Comp (UInt 8)
example = do
    x <- input Public
    y <- input Public
	  return $ x .*. y .*. 42

What's Next?

The carry-less modulo is the next operator on our roadmap after the multiplication operator. We’re also working on integrating with the Snarkjs/Circom toolchain to streamline witness generation.

Stay tuned for more exciting developments in the coming releases!