How to Send Strings as Signals to Circom?

I want to create a circuit to measure the length of a string in Circom. There are only numeric data types, how can I do that?

2

1 Answer

You can supply string as a series of bytes. You can:

  • Make your circuit take in an array of signals of length 256
  • Iterate over the array
  • Look for first 0 byte
  • Save the index as string length

This will allow you to measure string lengths of up to 256 bytes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest